All files / tasks/util process.ts

100% Statements 9/9
100% Branches 8/8
100% Functions 3/3
100% Lines 9/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1842x   9x 6x 6x 6x     42x     5x     42x 1x    
import { execSync, spawnSync } from 'child_process';
 
function applyOptions(options: any = {}) {
	options.encoding = options.encoding || 'utf8';
	options.stdio = options.stdio || (options.silent ? 'pipe' : 'inherit');
	return options;
}
 
export function exec(command: string, options?: any) {
	// Use execSync from child_process instead of shelljs.exec for better
	// handling of pass-through stdio
	return execSync(command, applyOptions(options));
}
 
export function spawn(command: string, args: string[], options?: any) {
	return spawnSync(command, args, applyOptions(options));
}