#!/usr/bin/env node // var env = Object.assign(ENV, process.env, {wd: process.cwd(), cwd: __dirname, FORCE_COLOR : 'true', NPM_CONFIG_COLOR : 'always' }) var env = Object.assign({}, process.env, {wd: process.cwd() , FORCE_COLOR : 'true', NPM_CONFIG_COLOR : 'always' }) // console.dir(env) const spawn = require('child_process').spawn; // console.dir(process.argv.slice(2)) let npmcmd = (process.platform === 'win32' ? 'npm.cmd' : 'npm') let npmrun = (process.platform === 'win32' ? [ '--color=always', 'run', 'index', '--'] : ['run', 'index_linux', '--']) // let npmcmd = 'node' // let npmrun = (process.platform === 'win32' ? [ '../index', '--'] : ['run', 'index_linux', '--']) const child = spawn( npmcmd , npmrun.concat(process.argv.slice(2)), { env, cwd: __dirname , stdio: [process.stdin, process.stdout, process.stderr] , inherit: true , shell: true }); // 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()); // });