fix(core): report removed running shells as killed (#56982)

This commit is contained in:
Aiden Cline
2026-10-19 10:37:21 -05:00
committed by GitHub
Unverified
parent 815de9950b
commit ce15cd8821
+4
View File
@@ -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