Skip to content

Commit

Permalink
workaround for Mutex::Lock not being signal-safe (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasMadsen authored and mafintosh committed Feb 7, 2018
1 parent 96a79c2 commit 3729281
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class ClinicDoctor {
fs.rename(
'node_trace.1.log', paths['/traceevent'],
function (err) {
/* istanbul ignore if: the node_trace file should always exists */
if (err) return callback(err, paths['/'])
callback(null, paths['/'])
}
Expand Down
5 changes: 5 additions & 0 deletions sampler.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ process.once('beforeexit', function () {
clearTimeout(timer)
processStatEncoder.end()
})

// NOTE: Workaround until https://github.com/nodejs/node/issues/18476 is solved
process.on('SIGINT', function () {
if (process.listenerCount('SIGINT') === 1) process.exit(0)
})

0 comments on commit 3729281

Please sign in to comment.