mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
15 lines
305 B
TypeScript
15 lines
305 B
TypeScript
|
import {spawnSync} from 'child_process';
|
||
|
|
||
|
export const spawnAndLog = (...args: string[]): void => {
|
||
|
const {stdout, stderr} = spawnSync(args[0]!, args.slice(1), {
|
||
|
encoding: 'utf-8',
|
||
|
shell: true,
|
||
|
});
|
||
|
if (stdout) {
|
||
|
console.log(stdout);
|
||
|
}
|
||
|
if (stderr) {
|
||
|
console.error(stderr);
|
||
|
}
|
||
|
};
|