diff --git a/packages/subprocess/subprocess-local/src/index.ts b/packages/subprocess/subprocess-local/src/index.ts index 0ddbcfec31..a45c25986e 100644 --- a/packages/subprocess/subprocess-local/src/index.ts +++ b/packages/subprocess/subprocess-local/src/index.ts @@ -187,9 +187,8 @@ export class LocalSubprocessRuntime extends SubprocessRuntime { : platform === 'win32' ? 'the Win32 Job runner is unavailable' : `platform ${platform} has no native managed range` - process.emitWarning( + this.ctx.logger.warn( `subprocess-local is using weaker process-tree containment because ${reason}; descendants that escape the process group or direct-parent tree are not guaranteed to terminate or delay waitForExit()`, - { code: 'DSH_SUBPROCESS_WEAK_CONTAINMENT' }, ) } diff --git a/packages/subprocess/subprocess-local/tests/local.spec.ts b/packages/subprocess/subprocess-local/tests/local.spec.ts index 6d1ab9cee9..770acaf1d6 100644 --- a/packages/subprocess/subprocess-local/tests/local.spec.ts +++ b/packages/subprocess/subprocess-local/tests/local.spec.ts @@ -401,8 +401,8 @@ describe('LocalSubprocessRuntime', () => { }) it('warns once when ordinary spawns use the weaker macOS fallback', async () => { - const warning = vi.spyOn(process, 'emitWarning').mockImplementation(() => {}) const ctx = new Context() + const warning = vi.spyOn(ctx.logger, 'warn').mockImplementation(() => {}) const fiber = await ctx.plugin(LocalSubprocessRuntime) const runtime = ctx.subprocess as LocalSubprocessRuntime runtime.internals = { platform: 'darwin' } @@ -413,7 +413,6 @@ describe('LocalSubprocessRuntime', () => { expect(warning).toHaveBeenCalledOnce() expect(warning).toHaveBeenCalledWith( expect.stringContaining('descendants that escape the process group'), - { code: 'DSH_SUBPROCESS_WEAK_CONTAINMENT' }, ) } finally { warning.mockRestore() @@ -422,8 +421,8 @@ describe('LocalSubprocessRuntime', () => { }) it('reports the platform-specific reason for every fallback mode', async () => { - const warning = vi.spyOn(process, 'emitWarning').mockImplementation(() => {}) const ctx = new Context() + const warning = vi.spyOn(ctx.logger, 'warn').mockImplementation(() => {}) const fiber = await ctx.plugin(LocalSubprocessRuntime) const runtime = ctx.subprocess as unknown as { fallbackWarned: boolean @@ -440,7 +439,6 @@ describe('LocalSubprocessRuntime', () => { runtime.warnFallback(platform) expect(warning).toHaveBeenLastCalledWith( expect.stringContaining(reason), - { code: 'DSH_SUBPROCESS_WEAK_CONTAINMENT' }, ) } const calls = warning.mock.calls.length