-
-
Save Choirrulloh/e885147e0c1d81ab86c8afad8f5748ab 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