Skip to content

Commit ffd3bec

Browse files
committed
only unref timers if unref is available
Fix #374
1 parent 2003990 commit ffd3bec

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/base.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ Base.prototype.setTimeout = function (n) {
7373
} else {
7474
this.start = Date.now()
7575
this.timer = setTimeout(this.timeout.bind(this), n)
76-
this.timer.unref()
76+
if (this.timer.unref)
77+
this.timer.unref()
7778
}
7879
}
7980

lib/spawn.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,6 @@ Spawn.prototype.timeout = function (extra) {
135135
this.proc.kill('SIGKILL')
136136
}
137137
}.bind(this), 1000)
138-
t.unref()
138+
if (t.unref)
139+
t.unref()
139140
}

0 commit comments

Comments
 (0)