Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function spawnStreaming(
command: string,
args: string[],
opts: execa.Options,
{ prefix }: { prefix: string }
) {
const spawned = execa(command, args, {
stdio: ['ignore', 'pipe', 'pipe'],
...opts,
});
const color = nextColor();
const prefixedStdout = logTransformer({ tag: `${color.bold(prefix)}:` });
const prefixedStderr = logTransformer({
mergeMultiline: true,
tag: `${logSymbols.error} ${color.bold(prefix)}:`,
});
spawned.stdout.pipe(prefixedStdout).pipe(process.stdout);
spawned.stderr.pipe(prefixedStderr).pipe(process.stderr);
return spawned;
}
export function spawnStreaming(
command: string,
args: string[],
opts: execa.Options,
{ prefix }: { prefix: string }
) {
const spawned = execa(command, args, {
stdio: ['ignore', 'pipe', 'pipe'],
...opts,
});
const color = nextColor();
const prefixedStdout = logTransformer({ tag: `${color.bold(prefix)}:` });
const prefixedStderr = logTransformer({
mergeMultiline: true,
tag: `${logSymbols.error} ${color.bold(prefix)}:`,
});
spawned.stdout.pipe(prefixedStdout).pipe(process.stdout);
spawned.stderr.pipe(prefixedStderr).pipe(process.stderr);
return spawned;
}