Set the process exit code and return, rather than calling process.exit.
process.exit truncates output that has been written to a pipe but not yet
flushed — which is precisely the case a CLI piping into another tool hits, so
using it after any write risks losing the very output the caller asked for.
Setting exitCode lets the event loop drain naturally.
Set the process exit code and return, rather than calling
process.exit.process.exittruncates output that has been written to a pipe but not yet flushed — which is precisely the case a CLI piping into another tool hits, so using it after anywriterisks losing the very output the caller asked for. SettingexitCodelets the event loop drain naturally.