Skip to content

Commit 584dddc

Browse files
rogeriopvljohnjbarton
authored andcommittedDec 8, 2018
fix: improve error msg when bin is a directory (#3231)
1 parent bb022a7 commit 584dddc

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
 

‎lib/launchers/process.js

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ function ProcessLauncher (spawn, tempDir, timer, processKillTimeout) {
8787
if (err.code === 'ENOENT') {
8888
self._retryLimit = -1
8989
errorOutput = `Can not find the binary ${cmd}\n\tPlease set env variable ${self.ENV_CMD}`
90+
} else if (err.code === 'EACCES') {
91+
self._retryLimit = -1
92+
errorOutput = `Permission denied accessing the binary ${cmd}\n\tMaybe it's a directory?`
9093
} else {
9194
errorOutput += err.toString()
9295
}

‎test/unit/launchers/process.spec.js

+20
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,26 @@ describe('launchers/process.js', () => {
9393
done()
9494
})
9595
})
96+
97+
it('should handle spawn EACCES error and not even retry', (done) => {
98+
ProcessLauncher.call(launcher, mockSpawn, mockTempDir)
99+
RetryLauncher.call(launcher, 2)
100+
launcher._getCommand = () => BROWSER_PATH
101+
102+
const failureSpy = sinon.spy()
103+
emitter.on('browser_process_failure', failureSpy)
104+
105+
launcher.start('http://host:9876/')
106+
mockSpawn._processes[0].emit('error', {code: 'EACCES'})
107+
mockSpawn._processes[0].emit('exit', 1)
108+
mockTempDir.remove.callArg(1)
109+
110+
_.defer(() => {
111+
expect(launcher.state).to.equal(launcher.STATE_FINISHED)
112+
expect(failureSpy).to.have.been.called
113+
done()
114+
})
115+
})
96116
})
97117

98118
// higher level tests with Retry and CaptureTimeout launchers

0 commit comments

Comments
 (0)
Please sign in to comment.