Skip to content

Instantly share code, notes, and snippets.

@cliffoo
Last active December 8, 2022 04:00
Show Gist options
  • Save cliffoo/2bd76a69fbff35263e1fd32349d25d83 to your computer and use it in GitHub Desktop.
Save cliffoo/2bd76a69fbff35263e1fd32349d25d83 to your computer and use it in GitHub Desktop.
const { spawn } = require("child_process");
const child = spawn("ls -a && ls -l && ls -al", {
cwd: __dirname,
shell: true // This must be true
});
const print = x => console.log(x.toString());
child.stdout.on("data", print);
child.stderr.on("data", print);
child.on("close", () => console.log("Done"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment