Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
const { code, stdout, stderr } = await execute(dockerPath, args);
if (code === 0) {
dockerId = stdout;
const logs = execute(dockerPath, ['logs', dockerId, '--follow']);
let errorLogs = [];
logs.stderr.on('data', chunk => {
errorLogs.push(chunk);
});
host = await getNetworkHost(execute, dockerId);
try {
await waitOnCDPAvailable(host, port);
} catch (error) {
if (error.message === 'Timeout' && errorLogs.length !== 0) {
throw new ChromeError(
`Chrome failed to start with ${
errorLogs.length === 1 ? 'error' : 'errors'
} ${errorLogs
.map(e => `"${e.toString('utf8').trim()}"`)
.join(', ')}`
);
}
throw error;
} finally {
if (logs.code === null && !logs.killed) {
logs.kill();
}
errorLogs = null;
}
debug(`Docker started with id ${dockerId}`);
} else {