Explorar el Código

refactor(subprocess): use mode as fallback warning latch

pku-xht hace 1 mes
padre
commit
8b81d77d54

+ 0 - 3
packages/subprocess/subprocess-local/src/index.ts

@@ -45,7 +45,6 @@ export class LocalSubprocessRuntime extends SubprocessRuntime {
   internals: SpawnInternals = {}
   /** Ordinary native containment mode, selected once before its first user command. */
   private ordinaryMode: 'linux-scope' | 'windows-job' | 'fallback' | undefined
-  private fallbackWarned = false
   /** Test hook for platform process inspection; production resolves lazily on terminal spawn. */
   terminalInspector: ProcessInspector | undefined
 
@@ -178,8 +177,6 @@ export class LocalSubprocessRuntime extends SubprocessRuntime {
   }
 
   private warnFallback(platform: NodeJS.Platform): void {
-    if (this.fallbackWarned) return
-    this.fallbackWarned = true
     const reason = platform === 'darwin'
       ? 'macOS has no supported persistent process-range owner'
       : platform === 'linux'

+ 0 - 5
packages/subprocess/subprocess-local/tests/local.spec.ts

@@ -425,7 +425,6 @@ describe('LocalSubprocessRuntime', () => {
     const warning = vi.spyOn(ctx.logger, 'warn').mockImplementation(() => {})
     const fiber = await ctx.plugin(LocalSubprocessRuntime)
     const runtime = ctx.subprocess as unknown as {
-      fallbackWarned: boolean
       warnFallback(platform: NodeJS.Platform): void
     }
     try {
@@ -435,15 +434,11 @@ describe('LocalSubprocessRuntime', () => {
         ['win32', 'the Win32 Job runner is unavailable'],
         ['freebsd', 'platform freebsd has no native managed range'],
       ] as const) {
-        runtime.fallbackWarned = false
         runtime.warnFallback(platform)
         expect(warning).toHaveBeenLastCalledWith(
           expect.stringContaining(reason),
         )
       }
-      const calls = warning.mock.calls.length
-      runtime.warnFallback('linux')
-      expect(warning).toHaveBeenCalledTimes(calls)
     } finally {
       warning.mockRestore()
       await fiber.dispose()