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.

пре 2 година
пре 2 година
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env node
  2. var ENV = Object.assign({}, process.env); // Shallow clone it.
  3. const spawn = require('child_process').spawn;
  4. console.dir(process.argv.slice(2))
  5. let npmcmd = (process.platform === 'win32' ? 'npm.cmd' : 'npm')
  6. let npmrun = (process.platform === 'win32' ? ['run', 'index', '--'] : ['run', 'index_linux', '--'])
  7. const child = spawn(
  8. npmcmd
  9. , npmrun.concat(process.argv.slice(2)), { env : Object.assign({}, process.env, {wd: process.cwd()}), cwd: __dirname });
  10. // const child = spawn(
  11. // 'C:\\Program Files\\Git\\bin\\sh.exe'
  12. // , ['notepad', 'index'], { cwd: __dirname });
  13. // ENV.FORCE_COLOR = true;
  14. // const child = spawn(
  15. // 'node'
  16. // , ['../index.js', 'pull'], { env : ENV, cwd: __dirname });
  17. process.stdin.pipe(child.stdin)
  18. child.stdout.pipe(process.stdout)
  19. child.stderr.pipe(process.stderr)
  20. // started.stdout.on('data', function (data) {
  21. // console.log('stdout:', data.toString());
  22. // });
  23. // started.stderr.on('data', function (data) {
  24. // console.log('stderr:', data.toString());
  25. // });
  26. // started.on('exit', function (code) {
  27. // console.log('child process exited with code:', code.toString());
  28. // });