Last active
August 8, 2018 08:37
-
-
Save EmmanuelKasper/1f694c6b0667fddf509987cbdc0906e6 to your computer and use it in GitHub Desktop.
Nodejs shell like programming: calling an external command and returning output to stdout
This file contains hidden or 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
#! env node | |
// execFileSync will call the command directly without using a shell, a tad faster and prevents interpretation of characters | |
// ( similar to C and java exec ) | |
const exec = require('child_process').execFileSync; | |
// inherit will use the stdio of the parent process, ie this nodejs script | |
exec('wget', ['https://git.kernel.org/torvalds/t/linux-4.18-rc8.tar.gz', '--output-document', '/tmp/bla'], {stdio:'inherit'}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment