mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix(cli): preserve codex config args on Windows
This commit is contained in:
@@ -4,15 +4,17 @@ import { EventEmitter } from 'node:events';
|
||||
// Create a fake child process emitter for each test
|
||||
let childEmitter: EventEmitter & { exitCode: number | null; killed: boolean; pid: number };
|
||||
|
||||
vi.mock('node:child_process', () => ({
|
||||
spawn: vi.fn(() => {
|
||||
childEmitter = Object.assign(new EventEmitter(), {
|
||||
exitCode: null,
|
||||
killed: false,
|
||||
pid: 12345,
|
||||
});
|
||||
return childEmitter;
|
||||
}),
|
||||
const spawnMock = vi.hoisted(() => vi.fn(() => {
|
||||
childEmitter = Object.assign(new EventEmitter(), {
|
||||
exitCode: null,
|
||||
killed: false,
|
||||
pid: 12345,
|
||||
});
|
||||
return childEmitter;
|
||||
}));
|
||||
|
||||
vi.mock('cross-spawn', () => ({
|
||||
default: spawnMock
|
||||
}));
|
||||
|
||||
vi.mock('@/ui/logger', () => ({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { spawn, type SpawnOptions, type StdioOptions } from 'node:child_process';
|
||||
import type { SpawnOptions, StdioOptions } from 'node:child_process';
|
||||
import spawn from 'cross-spawn';
|
||||
import { logger } from '@/ui/logger';
|
||||
import { killProcessByChildProcess } from '@/utils/process';
|
||||
|
||||
@@ -149,4 +150,3 @@ export async function spawnWithAbort(options: SpawnWithAbortOptions): Promise<vo
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user