| 83 | } |
| 84 | |
| 85 | function runProg(args, cb) { |
| 86 | if (isDryRun) { |
| 87 | args.unshift('echo'); |
| 88 | } |
| 89 | // console.log('Executing ' + args.join(' ')); |
| 90 | const cmd = args.join(' '); |
| 91 | const arg0 = args.shift(); |
| 92 | const prog = child_process.spawn(arg0, args, { |
| 93 | stdio:'inherit' |
| 94 | }); |
| 95 | prog.on('error', (error) => { |
| 96 | console.error(`Error running '${cmd}': ${error.message}`); |
| 97 | if (cb) { |
| 98 | cb(-1); |
| 99 | } |
| 100 | }); |
| 101 | prog.on("close", (code) => { |
| 102 | if (!isDryRun) { |
| 103 | console.log(`'${cmd}' ... exited with code ${code}`); |
| 104 | } |
| 105 | if (cb) { |
| 106 | cb(code); |
| 107 | } |
| 108 | }); |
| 109 | } |
| 110 | |
| 111 | function run() { |
| 112 | let isPkg = true; |