You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env node
  2. // var env = Object.assign(ENV, process.env, {wd: process.cwd(), cwd: __dirname, FORCE_COLOR : 'true', NPM_CONFIG_COLOR : 'always' })
  3. var env = Object.assign({}, process.env, {wd: process.cwd()
  4. , FORCE_COLOR : 'true', NPM_CONFIG_COLOR : 'always'
  5. })
  6. // console.dir(env)
  7. const spawn = require('child_process').spawn;
  8. // console.dir(process.argv.slice(2))
  9. let npmcmd = (process.platform === 'win32' ? 'npm.cmd' : 'npm')
  10. let npmrun = (process.platform === 'win32' ? [ '--color=always', 'run', 'index', '--'] : ['run', 'index_linux', '--'])
  11. // let npmcmd = 'node'
  12. // let npmrun = (process.platform === 'win32' ? [ '../index', '--'] : ['run', 'index_linux', '--'])
  13. const child = spawn(
  14. npmcmd
  15. , npmrun.concat(process.argv.slice(2)), {
  16. env, cwd: __dirname
  17. , stdio: [process.stdin, process.stdout, process.stderr]
  18. , inherit: true
  19. , shell: true
  20. });
  21. // const child = spawn(
  22. // 'C:\\Program Files\\Git\\bin\\sh.exe'
  23. // , ['notepad', 'index'], { cwd: __dirname });
  24. // ENV.FORCE_COLOR = true;
  25. // const child = spawn(
  26. // 'node'
  27. // , ['../index.js', 'pull'], { env : ENV, cwd: __dirname });
  28. // process.stdin.pipe(child.stdin)
  29. // child.stdout.pipe(process.stdout)
  30. // child.stderr.pipe(process.stderr)
  31. // started.stdout.on('data', function (data) {
  32. // console.log('stdout:', data.toString());
  33. // });
  34. // started.stderr.on('data', function (data) {
  35. // console.log('stderr:', data.toString());
  36. // });
  37. // started.on('exit', function (code) {
  38. // console.log('child process exited with code:', code.toString());
  39. // });