-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serve command doesn't detect nodeJS app process exiting #9239
Comments
When you say:
I feel like this should only be true if the In the case where This will help those of us developing jobs (as opposed to always on servers) to chain subsequent commands/notifications. Right now, it seems like the only choice is to build and run. |
I would agree 🎉 Side note: I am in fact writing a job that runs once and exits, but I want to develop with "watch" mode. The use case is to re-run the job on any code change, including re-attempt the job after fixing a crash in a previous job run :) If the job completes, I would want output in the terminal as such, and if it exits I would also want feedback in the terminal. In both cases, I'd want it to start the job again on any code change (but only if watch mode is on) |
That's helpful context in your side note @joshribakoff-sm. It made me wonder... I like that watch auto reloads, but I wish that I could have the option to let the job finish before reloading, or allow for specific Grace periods instead of 'instantly'. Maybe this already exists and I've forgotten or don't know about it. I think in the past, I've tried to delay on a SIGINT in my code, but what happens (I have to double check) is that the next job starts and then they are both running. I probably just could write a better, faster SIGINT cleanup, but it's still my uninformed impression that the grace period is 0 and isn't configurable. Anyways, not sure if this wondering is relevant. |
BTW, the way I am getting the functionality I need is to use an #!/usr/bin/expect -f
set timeout -1
puts "Running with args: $argv\r"
spawn tools/scripts/run-my-app.sh $argv
expect "[My app] is exiting with"
send "done\r"
exit 0 And in
|
It's not only |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
not stale 😬 |
Yeah just hit this +1 |
Not stale! Please fix |
Yes please fix |
Yes please fix Yes please fix :) |
Quick and dirty solution? Kill the parent process: process.kill(process.ppid, 'SIGTERM') Beware this makes nx report an error: |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
Keep |
I have spent the whole morning trying to get my script with I run scripts in azure pipelines which I NEED to have Can you make the executor propagate the error when watch is set to false so we can use process.exit(1) instead of process.kill ? |
I was going to create an issue but I've just found this one. Here's more info and a repo to duplicate the issue: Repo: Link: repo to duplicate the issue The app in the referenced repository throws a simulated error that should result in an exit code of 1. Steps:
This is the only step required. Despite the error being displayed, the output still reads:
This implies that the host will never know if the application encountered an error during execution, as the Node executor incorrectly returns an exit code of 0 instead of 1. Additional Information: Nx report
Additional Information Although the issue is not observable when I think these are the relevant lines: nx/packages/js/src/executors/node/node.impl.ts Lines 172 to 178 in a44475c
Basically, if the task is not being watched, it is signaled as |
This is fixed here #22705 |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
Serve a nodeJS program that does
process.exit(1)
.It does not output anything and the user has to rely on other observations to deduce that their code exited. In fact editing the code still creates normal webpack output as if the process was reloaded, but the process is dead and is never restarted. The developer has to kill the
serve
command manually and restart it manually to restore the nodeJS app's process.Expected Behavior
The
serve
command should output a message saying that my code exited, and what the exit code was. Editing any code should start the process back up [if it was dead]. I expect making an edit to the code and webpack "reloading" to restart a dead nodeJS program automatically.Steps to Reproduce
Create a node app that does this
Environment
Mac OS
This is also a duplicate of #4054 it appears that issue was closed despite the linked fix being totally tangential to the root issue
The text was updated successfully, but these errors were encountered: