本文整理汇总了TypeScript中child_process.ChildProcess.unref方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ChildProcess.unref方法的具体用法?TypeScript ChildProcess.unref怎么用?TypeScript ChildProcess.unref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类child_process.ChildProcess
的用法示例。
在下文中一共展示了ChildProcess.unref方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: launchFirefox
export async function launchFirefox(
launch: ParsedLaunchConfiguration,
sendToConsole: (msg: string) => void,
addonManager?: AddonManager
): Promise<ChildProcess | undefined> {
let profile = await prepareDebugProfile(launch);
if (addonManager) {
await addonManager.profilePrepared(profile);
}
let childProc: ChildProcess | undefined = undefined;
if (launch.detached) {
let forkedLauncherPath = path.join(__dirname, '../util/forkedLauncher.js');
let forkArgs: string[];
switch (launch.tmpDirs.length) {
case 0:
forkArgs = [
'spawnDetached', launch.firefoxExecutable, ...launch.firefoxArgs
];
break;
case 1:
forkArgs = [
'spawnDetached', process.execPath, forkedLauncherPath,
'spawnAndRemove', launch.tmpDirs[0], launch.firefoxExecutable, ...launch.firefoxArgs
];
break;
default:
forkArgs = [
'spawnDetached', process.execPath, forkedLauncherPath,
'spawnAndRemove2', launch.tmpDirs[0], launch.tmpDirs[1], launch.firefoxExecutable, ...launch.firefoxArgs
];
break;
}
fork(forkedLauncherPath, forkArgs, { execArgv: [] });
} else {
childProc = spawn(launch.firefoxExecutable, launch.firefoxArgs, { detached: true });
childProc.stdout.on('data', (data) => {
let msg = (typeof data === 'string') ? data : data.toString('utf8');
msg = msg.trim();
sendToConsole(msg);
});
childProc.unref();
}
return childProc;
}