Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function createNewDebuggerInstance() {
const { port } = instance;
debug(`Launching new tab with debugger at port ${port}`);
const target = await CDP.New({ port });
debug(`Launched with target id ${target.id}`);
const client = await CDP({ port, target });
client.close = () => {
debug('New closing tab');
return CDP.Close({ port, id: target.id });
};
return client;
}
return createChromeTarget(start, stop, createNewDebuggerInstance, baseUrl);
}
client.close = () => {
debug('New closing tab');
return CDP.Close({ host, port, id: target.id });
};
return client;
}
process.on('SIGINT', () => {
if (dockerId) {
const maybeSudo = dockerWithSudo ? 'sudo ' : '';
execSync(`${maybeSudo}${dockerPath} kill ${dockerId}`);
}
});
return createChromeTarget(
start,
stop,
createNewDebuggerInstance,
dockerUrl,
ensureImageDownloaded
);
}