mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 18:44:30 -07:00
fix(core)#20941: reap orphaned descendant processes on PTY abort (#21124)
Co-authored-by: Spencer <spencertang@google.com>
This commit is contained in:
@@ -1398,12 +1398,11 @@ describe('ShellExecutionService child_process fallback', () => {
|
||||
expectedSignal,
|
||||
);
|
||||
} else {
|
||||
expect(mockCpSpawn).toHaveBeenCalledWith(expectedCommand, [
|
||||
'/pid',
|
||||
String(mockChildProcess.pid),
|
||||
'/f',
|
||||
'/t',
|
||||
]);
|
||||
expect(mockCpSpawn).toHaveBeenCalledWith(
|
||||
expectedCommand,
|
||||
['/pid', String(mockChildProcess.pid), '/f', '/t'],
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1181,10 +1181,12 @@ export class ShellExecutionService {
|
||||
await this.cleanupLogStream(pid);
|
||||
|
||||
if (activeChild) {
|
||||
killProcessGroup({ pid }).catch(() => {});
|
||||
await killProcessGroup({ pid }).catch(() => {});
|
||||
this.activeChildProcesses.delete(pid);
|
||||
} else if (activePty) {
|
||||
killProcessGroup({ pid, pty: activePty.ptyProcess }).catch(() => {});
|
||||
await killProcessGroup({ pid, pty: activePty.ptyProcess }).catch(
|
||||
() => {},
|
||||
);
|
||||
try {
|
||||
(activePty.ptyProcess as IPty & { destroy?: () => void }).destroy?.();
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user