diff --git a/lib/launchers/process.js b/lib/launchers/process.js index 079fb089c..3734bed5c 100644 --- a/lib/launchers/process.js +++ b/lib/launchers/process.js @@ -87,6 +87,9 @@ function ProcessLauncher (spawn, tempDir, timer, processKillTimeout) { if (err.code === 'ENOENT') { self._retryLimit = -1 errorOutput = `Can not find the binary ${cmd}\n\tPlease set env variable ${self.ENV_CMD}` + } else if (err.code === 'EACCES') { + self._retryLimit = -1 + errorOutput = `Permission denied accessing the binary ${cmd}\n\tMaybe it's a directory?` } else { errorOutput += err.toString() } diff --git a/test/unit/launchers/process.spec.js b/test/unit/launchers/process.spec.js index 1cd9f0791..f8a4e58ef 100644 --- a/test/unit/launchers/process.spec.js +++ b/test/unit/launchers/process.spec.js @@ -93,6 +93,26 @@ describe('launchers/process.js', () => { done() }) }) + + it('should handle spawn EACCES error and not even retry', (done) => { + ProcessLauncher.call(launcher, mockSpawn, mockTempDir) + RetryLauncher.call(launcher, 2) + launcher._getCommand = () => BROWSER_PATH + + const failureSpy = sinon.spy() + emitter.on('browser_process_failure', failureSpy) + + launcher.start('http://host:9876/') + mockSpawn._processes[0].emit('error', {code: 'EACCES'}) + mockSpawn._processes[0].emit('exit', 1) + mockTempDir.remove.callArg(1) + + _.defer(() => { + expect(launcher.state).to.equal(launcher.STATE_FINISHED) + expect(failureSpy).to.have.been.called + done() + }) + }) }) // higher level tests with Retry and CaptureTimeout launchers