From 174acf2c88a4518f36b56ce29fee15d35a4d81ae Mon Sep 17 00:00:00 2001 From: w-vi Date: Fri, 21 Aug 2015 12:24:23 +0200 Subject: [PATCH] Quick fix for the reporters issue #263 This really is more of a workaround rather then proper fix. Dredd needs to refactor and rework of the language hooks handling, especially graceful stopping as `SIGKILL` is definitely not the way to go. --- src/dredd-command.coffee | 4 ++-- src/hooks-worker-client.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dredd-command.coffee b/src/dredd-command.coffee index 3194d4d98..c7cbeb73f 100644 --- a/src/dredd-command.coffee +++ b/src/dredd-command.coffee @@ -174,11 +174,11 @@ class DreddCommand @_processExit(2) # Ensure server is not running when dredd exits prematurely somewhere - process.on 'beforeExit', () -> + process.on 'beforeExit', () => @serverProcess.kill('SIGKILL') if @serverProcess? # Ensure server is not running when dredd exits prematurely somewhere - process.on 'exit', () -> + process.on 'exit', () => @serverProcess.kill('SIGKILL') if @serverProcess? waitSecs = parseInt(@argv['server-wait'], 10) diff --git a/src/hooks-worker-client.coffee b/src/hooks-worker-client.coffee index d240f823e..5ac62a96e 100644 --- a/src/hooks-worker-client.coffee +++ b/src/hooks-worker-client.coffee @@ -60,8 +60,8 @@ handler.stderr.on 'data', (data) -> console.log "Hook handler stderr:", data.toString() handler.on 'close', (status) -> - console.log "Hook handler exited with status: #{status}" - if status != 0 + console.log "Hook handler closed with status: #{status}" + if status? and status != 0 hooks.processExit 2 handler.on 'error', (error) ->