-
Notifications
You must be signed in to change notification settings - Fork 245
On Linux cross-env returns exit code 0 when then child command is killed #150
On Linux cross-env returns exit code 0 when then child command is killed #150
Comments
Thanks for the report @esistgut! I'm happy to accept a PR that's tested 👍 |
I have checked briefly the codebase. The node.js child_process exit event does not give any exitcode when the subprocess dies. It gets invoked with Reading the node.js documentation on 'exit' it's clearly stated that:
A quick fix would be returning @kentcdodds Regarding tests, how can it be done to make a test specific for linux platform? I am not sure yet this little fixup (but critical IMHO) can be testable with the actual runner PS: full disclosure, i work with @esistgut |
Could you verify whether the exit code is platform specific? |
yes the exit code on child_process acts differently based on platforms I tried finding how they handle process spawning (and errors) inside npm but It was inconclusive, for now |
Thanks for looking into that. I don't think that I want to proceed before we see some prior art. What are other tools that spawn processes doing in situations like this? I'm afraid that I don't have much time to dedicate to this problem, but I will look at and merge a pull request that's tested and has reference to somewhere else that's acceptably implementing things in the same way. Thanks again for reporting the issue and for your investigation! |
The biggest difference I noticed between
Killing the process (PID 177) would forward correctly the err codes and signals to the "father" shell, but if the "spawned shell" gets killed (PID 176) I get the exact same behaviour as Not suggesting a change here, I am merely adding details to the issue. |
Thanks for the investigation and details. |
This is a huge issue, I'm currently using The build command executes the following steps:
I read in the console that the build process seem to have succeeded:
But it's not really true, the build-rendered failed but cross-env fails to report the failed exit status which makes the build process continue creating an installer with missing files so our desktop app doesn't load... it fails silently!!!. This is how the app looks like when cross-env fails to report the exit status and a build is included with missing files: This is a huge issue. How can we fix this @kentcdodds ? |
I don't know how to fix this off the top of my head, but you're welcome to investigate further and submit a pull request. |
@kentcdodds found a solution, I'm testing it. I will send a PR soon. |
@kentcdodds it's impossible to setup this package from GitHub due all scripting involved(specially with yarn), it doesn't work from a local folder either so please make sure to test it and publish it ASAP so I can fix it for my users. If you want to see what's the issue with the binary when you try to use this module from local or github, try to use the binary from a project like this:
This doesn't work either:
it either doesn't find |
The v5.2.0 includes (amongst other things) a fix for incorrectly reported exit codes of child processes, which can prevent build build failures from correctly halting a build, resulting in incomplete or invalid builds. See kentcdodds/cross-env#150 (comment)
The v5.2.0 includes (amongst other things) a fix for incorrectly reported exit codes of child processes, which can prevent build build failures from correctly halting a build, resulting in incomplete or invalid builds. See kentcdodds/cross-env#150 (comment)
The v5.2.0 includes (amongst other things) a fix for incorrectly reported exit codes of child processes, which can prevent build build failures from correctly halting a build, resulting in incomplete or invalid builds. See kentcdodds/cross-env#150 (comment)
The v5.2.0 includes (amongst other things) a fix for incorrectly reported exit codes of child processes, which can prevent build build failures from correctly halting a build, resulting in incomplete or invalid builds. See kentcdodds/cross-env#150 (comment)
The v5.2.0 includes (amongst other things) a fix for incorrectly reported exit codes of child processes, which can prevent build build failures from correctly halting a build, resulting in incomplete or invalid builds. See kentcdodds/cross-env#150 (comment)
The v5.2.0 includes (amongst other things) a fix for incorrectly reported exit codes of child processes, which can prevent build build failures from correctly halting a build, resulting in incomplete or invalid builds. See kentcdodds/cross-env#150 (comment)
The v5.2.0 includes (amongst other things) a fix for incorrectly reported exit codes of child processes, which can prevent build build failures from correctly halting a build, resulting in incomplete or invalid builds. See kentcdodds/cross-env#150 (comment)
The v5.2.0 includes (amongst other things) a fix for incorrectly reported exit codes of child processes, which can prevent build build failures from correctly halting a build, resulting in incomplete or invalid builds. See kentcdodds/cross-env#150 (comment)
cross-env
version: 5.1.0node
version: 8.7.0npm
version: 5.4.2What you did:
$ ./node_modules/.bin/cross-env TEST=test sleep 10
from first shell$ killall sleep
from second shell$ echo $? 0
from the first shellWhat happened:
cross-env returns with exit code 0.
Problem description:
cross-env should return with exit code 143.
This is problematic if cross-env runs inside npm scripts and the command exits for unexpected reasons (our case is a OOM kill) because the execution continues without reporting errors.
The text was updated successfully, but these errors were encountered: