| 113 | const serverLog = []; |
| 114 | |
| 115 | function run(command, args) { |
| 116 | return new Promise((done) => { |
| 117 | const child = spawn(command, args, { |
| 118 | cwd: ROOT, |
| 119 | env: { |
| 120 | ...process.env, |
| 121 | NO_UPDATE_NOTIFIER: '1', |
| 122 | npm_config_update_notifier: 'false', |
| 123 | npm_config_audit: 'false', |
| 124 | npm_config_fund: 'false', |
| 125 | }, |
| 126 | stdio: ['ignore', 'pipe', 'pipe'], |
| 127 | }); |
| 128 | let out = ''; |
| 129 | child.stdout.on('data', (d) => { |
| 130 | out += d.toString(); |
| 131 | process.stdout.write(d); |
| 132 | }); |
| 133 | child.stderr.on('data', (d) => { |
| 134 | out += d.toString(); |
| 135 | process.stderr.write(d); |
| 136 | }); |
| 137 | child.on('error', (error) => done({ code: 127, out: out + error.message })); |
| 138 | child.on('close', (code) => done({ code: code ?? 1, out })); |
| 139 | }); |
| 140 | } |
| 141 | |
| 142 | // ------------------------------------------------------------- Testgriffe --- |
| 143 | |