-
-
Save sytranvn/e6705f2b3068e07a625c0e23fafb8bd7 to your computer and use it in GitHub Desktop.
Execute shell command in javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
function execute(command) { | |
const exec = require('child_process').exec | |
exec(command, (err, stdout, stderr) => { | |
process.stdout.write(stdout) | |
}) | |
} | |
execute('echo "Hello World!"') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment