packages/cli: force colored output of child processes of watch-deps

This commit is contained in:
Patrik Oldsberg
2020-02-28 00:20:51 +01:00
parent 04dfcce370
commit 500a9cfaaf
2 changed files with 3 additions and 1 deletions
@@ -5,6 +5,7 @@ import { createLogger } from './logger';
export function startChild(args: string[]) {
const [command, ...commandArgs] = args;
const child = spawn(command, commandArgs, {
env: { FORCE_COLOR: 'true', ...process.env },
stdio: ['inherit', 'pipe', 'pipe'],
});
@@ -13,13 +13,14 @@ export function startCompiler(pkg: Package, log: Logger) {
// Start the watch script inside the dependency
const watch = spawn('yarn', ['run', ...args], {
cwd: pkg.location,
env: { FORCE_COLOR: 'true', ...process.env },
stdio: 'pipe',
});
watch.stdin.end();
watch.stdout!.on('data', (data: Buffer) => {
log.out(data.toString('utf8'));
});
watch.stderr!.on('data', data => {
log.err(data.toString('utf8'));
});