| 134 | // Points SE_MANAGER_PATH at node itself, so the arguments decide what the |
| 135 | // "manager" does and the launcher is exercised without a real binary. |
| 136 | function launch(managerPath, args, env = {}) { |
| 137 | const childEnv = { ...process.env, SE_MANAGER_PATH: managerPath, ...env } |
| 138 | if (!('SE_AVOID_STATS' in env)) { |
| 139 | delete childEnv.SE_AVOID_STATS |
| 140 | } |
| 141 | const result = spawnSync(process.execPath, [LAUNCHER, ...args], { encoding: 'utf8', env: childEnv }) |
| 142 | return { stdout: result.stdout, error: result.stderr, status: result.status } |
| 143 | } |
| 144 | |
| 145 | test('the launcher passes through the manager exit code', () => { |
| 146 | const result = launch(process.execPath, ['-e', 'process.exit(3)']) |