Use child_process.execSync but keep output in console

后端 未结 4 1058
日久生厌
日久生厌 2020-12-07 10:43

I\'d like to use the execSync method which was added in NodeJS 0.12 but still have the output in the console window from which i ran the Node script.

E.

4条回答
  •  无人及你
    2020-12-07 11:10

    You can pass the parent´s stdio to the child process if that´s what you want:

    require('child_process').execSync(
        'rsync -avAXz --info=progress2 "/src" "/dest"',
        {stdio: 'inherit'}
    );
    

提交回复
热议问题