Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Commit

Permalink
Forward SIGTERM on bin wrapper to child process
Browse files Browse the repository at this point in the history
Killing the parent process leaves the phantomjs binary child process
orphaned, unless we forward the signal to the child as well.

This commit handles SIGTERM only. It might perhaps be an idea to do
the same or similar with SIGINT as well.
  • Loading branch information
myme committed Nov 23, 2012
1 parent 2742a3f commit 8921fb7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/phantomjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ var args = process.argv.slice(2)
var cp = spawn(binPath, args)
cp.stdout.pipe(process.stdout)
cp.stderr.pipe(process.stderr)
cp.on('exit', process.exit)
cp.on('exit', process.exit)

process.on('SIGTERM', function() {
cp.kill('SIGTERM')
process.exit(1)
})

0 comments on commit 8921fb7

Please sign in to comment.