Browse Source

fix(subprocess): isolate Linux native target group

pku-xht 1 month ago
parent
commit
6a34a0dd4b

+ 1 - 0
packages/subprocess/subprocess-local/src/spawn-runner.ts

@@ -133,6 +133,7 @@ async function runNode(
     cwd: request.cwd,
     env: request.env,
     stdio: 'inherit',
+    detached: true,
   })
   await new Promise<void>((resolve) => {
     let started = false

+ 7 - 0
packages/subprocess/subprocess-local/tests/spawn-runner.spec.ts

@@ -236,6 +236,13 @@ describe('spawn runner transport', () => {
         '--request', files.requestPath,
         '--events', files.eventsPath,
       ], asRunnerHost(host), fakeRunnerInternals({ spawn: injectedSpawn }))
+      expect(injectedSpawn).toHaveBeenCalledTimes(1)
+      expect(injectedSpawn).toHaveBeenCalledWith('node', [], {
+        cwd: process.cwd(),
+        env: {},
+        stdio: 'inherit',
+        detached: true,
+      })
       expect(host.exitCode).toBe(127)
       expect(readRunnerEvents(files.eventsPath)).toEqual([
         { type: 'started', pid: 4321 },