webpack-shell-plugin icon indicating copy to clipboard operation
webpack-shell-plugin copied to clipboard

suggestion on running a generic shell command

Open ORESoftware opened this issue 7 years ago • 0 comments

To run a generic shell command, do this:

const cp = require('child_process');

const k = cp.spawn('bash');
k.stdin.write('\n');
k.stdin.write('any command you would ever want in any format');
k.stdin.end();

the above will change your life when writing library code where the user gives you an arbitrary command to run.

ORESoftware avatar Oct 30 '17 15:10 ORESoftware