Permalink
Browse files

only one SIGTERM in softKiller

  • Loading branch information...
1 parent 9fc0679 commit 739cf53dce17b8c987821a8a2ea95fefae47d80e @bobrik bobrik committed Oct 4, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 init.coffee
View
@@ -84,16 +84,17 @@ exports.hardKiller = (timeout = 2000) ->
exports.softKiller = (timeout = 2000) ->
(pid, cb) ->
- first = true
+ sig = "SIGTERM"
tryKill = ->
try
# throws when the process no longer exists
- process.kill pid, "SIGTERM"
+ process.kill pid, sig
console.log "Waiting for pid " + pid
+ sig = 0 if sig != 0
first = false
setTimeout tryKill, timeout
catch e
- cb(!first)
+ cb(sig == 0)
tryKill()
exports.stop = (pidfile, cb = exports.stopped, killer = hardKiller) ->

0 comments on commit 739cf53

Please sign in to comment.