|
|
|
|
|
|
|
|
#!/usr/bin/env node |
|
|
#!/usr/bin/env node |
|
|
|
|
|
|
|
|
var ENV = Object.assign({}, process.env); // Shallow clone it. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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; |
|
|
const spawn = require('child_process').spawn; |
|
|
console.dir(process.argv.slice(2)) |
|
|
|
|
|
|
|
|
// console.dir(process.argv.slice(2)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let npmcmd = (process.platform === 'win32' ? 'npm.cmd' : 'npm') |
|
|
let npmcmd = (process.platform === 'win32' ? 'npm.cmd' : 'npm') |
|
|
let npmrun = (process.platform === 'win32' ? ['run', 'index', '--'] : ['run', 'index_linux', '--']) |
|
|
|
|
|
|
|
|
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( |
|
|
const child = spawn( |
|
|
npmcmd |
|
|
npmcmd |
|
|
, npmrun.concat(process.argv.slice(2)), { env : Object.assign({}, process.env, {wd: process.cwd()}), cwd: __dirname }); |
|
|
|
|
|
|
|
|
, npmrun.concat(process.argv.slice(2)), { |
|
|
|
|
|
env, cwd: __dirname |
|
|
|
|
|
, stdio: ['pipe', process.stdout, process.stderr], |
|
|
|
|
|
inherit: true, |
|
|
|
|
|
shell: true, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
// const child = spawn( |
|
|
// const child = spawn( |
|
|
// 'C:\\Program Files\\Git\\bin\\sh.exe' |
|
|
// 'C:\\Program Files\\Git\\bin\\sh.exe' |
|
|
|
|
|
|
|
|
// , ['../index.js', 'pull'], { env : ENV, cwd: __dirname }); |
|
|
// , ['../index.js', 'pull'], { env : ENV, cwd: __dirname }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
process.stdin.pipe(child.stdin) |
|
|
|
|
|
child.stdout.pipe(process.stdout) |
|
|
|
|
|
child.stderr.pipe(process.stderr) |
|
|
|
|
|
|
|
|
// process.stdin.pipe(child.stdin) |
|
|
|
|
|
// child.stdout.pipe(process.stdout) |
|
|
|
|
|
// child.stderr.pipe(process.stderr) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|