mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-09 17:29:12 +00:00
fix(shell): fix bash timeout hang when daemon inherits stdio pipes (#10)
- destroy stdout/stderr on abort to release stdio pipes held by detached daemons\n- use `exit` instead of `close` event to resolve exit promise Co-authored-by: haozhe.yang <yanghaozhe@moonshot.ai>
This commit is contained in:
parent
ee7486cb06
commit
67d3cb8ad0
2 changed files with 12 additions and 1 deletions
|
|
@ -275,6 +275,17 @@ export class BashTool implements BuiltinTool<BashInput> {
|
|||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
proc.stdout.destroy();
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
try {
|
||||
proc.stderr.destroy();
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
};
|
||||
|
||||
const onAbort = (): void => {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class LocalProcess implements KaosProcess {
|
|||
this.pid = child.pid ?? -1;
|
||||
|
||||
this._exitPromise = new Promise<number>((resolve, reject) => {
|
||||
child.on('close', (code: number | null) => {
|
||||
child.on('exit', (code: number | null) => {
|
||||
this._exitCode = code ?? -1;
|
||||
resolve(this._exitCode);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue