Skip to content

Commit

Permalink
fixes kentcdodds#150 exit code when os kills child process
Browse files Browse the repository at this point in the history
  • Loading branch information
bithavoc committed May 9, 2018
1 parent 450dae9 commit 97e7351
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ function crossEnv(args, options = {}) {
process.on('SIGINT', () => proc.kill('SIGINT'))
process.on('SIGBREAK', () => proc.kill('SIGBREAK'))
process.on('SIGHUP', () => proc.kill('SIGHUP'))
proc.on('exit', process.exit)
proc.on('exit', code => {
// exit code could be null when OS kills the process(out of memory, etc)
process.exit(code === null ? 1 : code)
})
return proc
}
return null
Expand Down Expand Up @@ -61,7 +64,7 @@ function parseCommand(args) {
const re = /\\\\|(\\)?'|([\\])(?=[$"\\])/g
// Eliminate all matches except for "\'" => "'"
return a.replace(re, m => {
if (m === "\\\\") return "\\"
if (m === '\\\\') return '\\'
if (m === "\\'") return "'"
return ''
})
Expand Down

0 comments on commit 97e7351

Please sign in to comment.