mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 17:27:54 +00:00
feat(core): refactor shell execution to use node-pty (#6491)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
@@ -65,7 +65,10 @@ describe('useShellCommandProcessor', () => {
|
||||
setPendingHistoryItemMock = vi.fn();
|
||||
onExecMock = vi.fn();
|
||||
onDebugMessageMock = vi.fn();
|
||||
mockConfig = { getTargetDir: () => '/test/dir' } as Config;
|
||||
mockConfig = {
|
||||
getTargetDir: () => '/test/dir',
|
||||
getShouldUseNodePtyShell: () => false,
|
||||
} as Config;
|
||||
mockGeminiClient = { addHistory: vi.fn() } as unknown as GeminiClient;
|
||||
|
||||
vi.mocked(os.platform).mockReturnValue('linux');
|
||||
@@ -104,13 +107,12 @@ describe('useShellCommandProcessor', () => {
|
||||
): ShellExecutionResult => ({
|
||||
rawOutput: Buffer.from(overrides.output || ''),
|
||||
output: 'Success',
|
||||
stdout: 'Success',
|
||||
stderr: '',
|
||||
exitCode: 0,
|
||||
signal: null,
|
||||
error: null,
|
||||
aborted: false,
|
||||
pid: 12345,
|
||||
executionMethod: 'child_process',
|
||||
...overrides,
|
||||
});
|
||||
|
||||
@@ -141,6 +143,7 @@ describe('useShellCommandProcessor', () => {
|
||||
'/test/dir',
|
||||
expect.any(Function),
|
||||
expect.any(Object),
|
||||
false,
|
||||
);
|
||||
expect(onExecMock).toHaveBeenCalledWith(expect.any(Promise));
|
||||
});
|
||||
@@ -223,7 +226,6 @@ describe('useShellCommandProcessor', () => {
|
||||
act(() => {
|
||||
mockShellOutputCallback({
|
||||
type: 'data',
|
||||
stream: 'stdout',
|
||||
chunk: 'hello',
|
||||
});
|
||||
});
|
||||
@@ -238,7 +240,6 @@ describe('useShellCommandProcessor', () => {
|
||||
act(() => {
|
||||
mockShellOutputCallback({
|
||||
type: 'data',
|
||||
stream: 'stdout',
|
||||
chunk: ' world',
|
||||
});
|
||||
});
|
||||
@@ -319,6 +320,7 @@ describe('useShellCommandProcessor', () => {
|
||||
'/test/dir',
|
||||
expect.any(Function),
|
||||
expect.any(Object),
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user