mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 13:54:01 +00:00
fix: ensure shell cmds can be properly aborted (#2339)
This commit is contained in:
parent
e9826e8a22
commit
029612d8d5
@ -1141,6 +1141,7 @@ export namespace Session {
|
||||
const proc = spawn(shell, args, {
|
||||
cwd: app.path.cwd,
|
||||
signal: abort.signal,
|
||||
detached: true,
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
env: {
|
||||
...process.env,
|
||||
@ -1148,6 +1149,11 @@ export namespace Session {
|
||||
},
|
||||
})
|
||||
|
||||
abort.signal.addEventListener("abort", () => {
|
||||
if (!proc.pid) return
|
||||
process.kill(-proc.pid)
|
||||
})
|
||||
|
||||
let output = ""
|
||||
|
||||
proc.stdout?.on("data", (chunk) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user