mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-15 04:27:20 +03:00
fix(core): report removed running shells as killed (#56982)
This commit is contained in:
committed by
GitHub
Unverified
parent
815de9950b
commit
ce15cd8821
@@ -174,6 +174,8 @@ const layer = () =>
|
||||
// Unblock any wait still pending when the command is removed before it terminated.
|
||||
yield* Deferred.fail(command.done, new NotFoundError({ id }))
|
||||
yield* Effect.promise(() => unlink(command.file).catch(() => {}))
|
||||
// Every shell reports exactly one exit; removing a running one ends it as killed.
|
||||
if (command.info.status === "running") yield* bus.publish(Shell.Event.Exited, { id, status: "killed" })
|
||||
yield* bus.publish(Shell.Event.Deleted, { id })
|
||||
})
|
||||
|
||||
@@ -407,6 +409,8 @@ const layer = () =>
|
||||
// Report the terminal status only once captured output is complete, so a reader that
|
||||
// sees it never reads a partial file.
|
||||
yield* outputDone.await
|
||||
// A removed command already failed its waiters and published its exit and deletion.
|
||||
if (commands.get(id) !== command) return
|
||||
command.info = produce(command.info, (draft) => {
|
||||
draft.status = outcome.status
|
||||
if (outcome.exit !== undefined) draft.exit = outcome.exit
|
||||
|
||||
Reference in New Issue
Block a user