Skip to content

Commit

Permalink
Merge branch 'master' of github.com:entropitor/dotenv-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
entropitor committed May 7, 2024
2 parents 40728f3 + 5845b5a commit 87c2998
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,17 @@ if (!command) {
process.exit(1)
}

spawn(command, argv._.slice(1), { stdio: 'inherit' })
const child = spawn(command, argv._.slice(1), { stdio: 'inherit' })
.on('exit', function (exitCode, signal) {
if (typeof exitCode === 'number') {
process.exit(exitCode)
} else {
process.kill(process.pid, signal)
}
})

for (const signal of ['SIGINT', 'SIGTERM', 'SIGPIPE', 'SIGHUP', 'SIGBREAK', 'SIGWINCH', 'SIGUSR1', 'SIGUSR2']) {
process.on(signal, function () {
child.kill(signal)
})
}

0 comments on commit 87c2998

Please sign in to comment.