From 1029bf2d7d3d22986aa41439d2ce4115770f4dbd Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sat, 11 May 2013 18:57:33 -0700 Subject: [PATCH] fix(launcher): ignore exit code when killing/timeouting Most of the browsers returns "not-normally" (because of receiving a signal) and therefore exit event gets null exit code. But PhantomJS exits "normally" with status code 1 (after receiving TERM signal). I think this logic is better - show error, if process exits during a state which does not expect exiting (CAPTURED, BEING_CAPTURED). Closes #444 --- lib/launchers/Base.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/launchers/Base.js b/lib/launchers/Base.js index dad008631..a5eafbe38 100644 --- a/lib/launchers/Base.js +++ b/lib/launchers/Base.js @@ -139,10 +139,14 @@ var BaseBrowser = function(id, emitter, captureTimeout, retryLimit) { this._onProcessExit = function(code, errorOutput) { log.debug('Process %s exitted with code %d', self.name, code); - if (code) { + if (self.state === BEING_CAPTURED) { log.error('Cannot start %s\n\t%s', self.name, errorOutput); } + if (self.state === CAPTURED) { + log.error('%s crashed.\n\t%s', self.name, errorOutput); + } + retryLimit--; if (self.state === BEING_CAPTURED || self.state === BEING_TIMEOUTED) {