fix(pipe): sort out pipes on platforms (#895)

This commit is contained in:
Pavel Feldman 2020-02-07 11:48:55 -08:00 committed by GitHub
parent 0ed43e8781
commit 42c2cfc7cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,13 +49,7 @@ let lastLaunchedId = 0;
export async function launchProcess(options: LaunchProcessOptions): Promise<LaunchResult> {
const id = ++lastLaunchedId;
let stdio: ('ignore' | 'pipe')[] = ['pipe', 'pipe', 'pipe'];
if (options.pipe) {
if (options.dumpio)
stdio = ['ignore', 'pipe', 'pipe', 'pipe', 'pipe'];
else
stdio = ['ignore', 'ignore', 'ignore', 'pipe', 'pipe'];
}
const stdio: ('ignore' | 'pipe')[] = options.pipe ? ['ignore', 'pipe', 'pipe', 'pipe', 'pipe'] : ['ignore', 'pipe', 'pipe'];
const spawnedProcess = childProcess.spawn(
options.executablePath,
options.args,
@ -80,8 +74,11 @@ export async function launchProcess(options: LaunchProcessOptions): Promise<Laun
}
if (options.dumpio) {
spawnedProcess.stderr.pipe(process.stderr);
spawnedProcess.stdout.pipe(process.stdout);
spawnedProcess.stderr.pipe(process.stderr);
} else {
spawnedProcess.stderr.on('data', () => {});
spawnedProcess.stdout.on('data', () => {});
}
let processClosed = false;