#!/usr/bin/env node var ENV = Object.assign({}, process.env); // Shallow clone it. const spawn = require('child_process').spawn; console.dir(process.argv.slice(2)) const child = spawn( (process.platform === 'win32' ? 'npm.cmd' : 'npm') , ['run', 'index', '--'].concat(process.argv.slice(2)), { cwd: __dirname }); // const child = spawn( // 'C:\\Program Files\\Git\\bin\\sh.exe' // , ['notepad', 'index'], { cwd: __dirname }); // ENV.FORCE_COLOR = true; // const child = spawn( // 'node' // , ['../index.js', 'pull'], { env : ENV, cwd: __dirname }); process.stdin.pipe(child.stdin) child.stdout.pipe(process.stdout) child.stderr.pipe(process.stderr) // started.stdout.on('data', function (data) { // console.log('stdout:', data.toString()); // }); // started.stderr.on('data', function (data) { // console.log('stderr:', data.toString()); // }); // started.on('exit', function (code) { // console.log('child process exited with code:', code.toString()); // });