Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const {spawn} = require('child_process');
const readline = require('readline');
const ls = spawn('ls', ['-lh', '/usr']);
const rl = readline.createInterface({
input: ls.stdout
});
rl.on('line', (line) => {
console.log(line);
});
ls.on('close', (code) => {
console.log(`code: ${code}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.