launcher: minor cleanup
This commit is contained in:
parent
865b0e3714
commit
acd4cdedcf
@ -4,9 +4,10 @@ import ConnectCDP from '../lib/cdp.js';
|
|||||||
import InjectInto from './inject.js';
|
import InjectInto from './inject.js';
|
||||||
|
|
||||||
const portRange = [ 10000, 60000 ];
|
const portRange = [ 10000, 60000 ];
|
||||||
|
const generatePort = () => (Math.floor(Math.random() * (portRange[1] - portRange[0] + 1)) + portRange[0]);
|
||||||
|
|
||||||
export default async (browserPath, args, transport, extra) => {
|
export default async (browserPath, args, transport, extra) => {
|
||||||
const port = transport === 'websocket' ? (Math.floor(Math.random() * (portRange[1] - portRange[0] + 1)) + portRange[0]) : null;
|
const port = transport === 'websocket' ? generatePort() : null;
|
||||||
|
|
||||||
const proc = spawn(browserPath, [
|
const proc = spawn(browserPath, [
|
||||||
transport === 'stdio' ? `--remote-debugging-pipe` : `--remote-debugging-port=${port}`,
|
transport === 'stdio' ? `--remote-debugging-pipe` : `--remote-debugging-port=${port}`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user