Skip to content

Commit

Permalink
Remove nitm SIGINT workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Aug 17, 2018
1 parent 56fb442 commit a98b679
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 2 additions & 4 deletions autocannon.js
Expand Up @@ -174,9 +174,7 @@ function start (argv) {
url: url
})
runTracker(opts, () => {
// `nitm` catches the SIGINT so we write it to a file descriptor
// instead of doing proc.kill()
socket.end('SIGINT')
proc.kill('SIGINT')
server.close()
})
})
Expand All @@ -193,7 +191,7 @@ function start (argv) {
const alterPath = managePath({ PATH: process.env.NODE_PATH })
alterPath.unshift(path.join(__dirname, 'lib/preload'))

spawn(argv.spawn[0], argv.spawn.slice(1), {
const proc = spawn(argv.spawn[0], argv.spawn.slice(1), {
stdio: ['ignore', 'inherit', 'inherit'],
env: Object.assign({}, process.env, {
NODE_OPTIONS: ['-r', 'autocannonDetectPort'].join(' '),
Expand Down
4 changes: 0 additions & 4 deletions lib/preload/autocannonDetectPort.js
Expand Up @@ -11,8 +11,4 @@ onListen(function (addr) {
socket.write(port)
})

// `nitm` catches the SIGINT so we write it to a file descriptor instead
socket.once('data', (chunk) => {
if (chunk.toString() === 'SIGINT') process.exit(0)
})
socket.unref()

0 comments on commit a98b679

Please sign in to comment.