mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix: ensure shell cmds can be properly aborted
This commit is contained in:
parent
2946898934
commit
b81aed2c45
1 changed files with 6 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue