Skip to content

Commit

Permalink
only unref timers if unref is available
Browse files Browse the repository at this point in the history
Fix #374
  • Loading branch information
isaacs committed Feb 7, 2017
1 parent 2003990 commit ffd3bec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ Base.prototype.setTimeout = function (n) {
} else {
this.start = Date.now()
this.timer = setTimeout(this.timeout.bind(this), n)
this.timer.unref()
if (this.timer.unref)
this.timer.unref()
}
}

Expand Down
3 changes: 2 additions & 1 deletion lib/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,6 @@ Spawn.prototype.timeout = function (extra) {
this.proc.kill('SIGKILL')
}
}.bind(this), 1000)
t.unref()
if (t.unref)
t.unref()
}

0 comments on commit ffd3bec

Please sign in to comment.