Created
August 26, 2019 16:40
-
-
Save alexrqs/4ec3971c99fa716d0421876ff4cac0c3 to your computer and use it in GitHub Desktop.
spawn child process with colors nodejs
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
#!/usr/bin/env node | |
if (process.platform == 'win32') { | |
process.exit(0) | |
} | |
const { spawn } = require('child_process') | |
const packages = ['webpack'] | |
const yarnAdd = ['yarn', 'add', '-D'] | |
.concat(packages) | |
.join(' ') | |
// in this form spawn don't need .stdio.on() || .stderr.on() || etc... | |
spawn('/bin/sh', ['-c', yarnAdd], { stdio: [0,1,2] }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment