Use child_process.execSync but keep output in console

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.g. if I run a NodeJS script which has the following line I’d like to see the full output of the rsync command “live” inside the console:

require('child_process').execSync('rsync -avAXz --info=progress2 "/src" "/dest"');

I understand that execSync returns the ouput of the command and that I could print that to the console after execution but this way I don’t have “live” output…

5 Answers
5

Leave a Comment