Skip to content

shjs command always exits with zero code #133

@ndelitski

Description

@ndelitski

Lets write a simple test test.js

process.exit(1)

then after i type shjs test.js || echo 1 console gives me no output, but node test.js || echo 1 ended with 1 code as expected. Tested in Linux and Windows.

Maybe I do not catch up something... But obviously shjs must persist exit code from script it running and i see this logic in shjs file, but in ./bin/shjs new child node process doesn't pass exit code to main process. Is the failed child process should not ruin parent process with error exit code? Maybe because it is asynchronous...

So I wait until the subprocess is completed and manualy close main process with the same exit code then all works perfect.

exec('node ' + scriptName + ' ' + args.join(' '), {async: true}, function(code) {
      exit(code);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions