diff --git a/packages/core/src/shell.ts b/packages/core/src/shell.ts index 508e50454f6..9ea658d533a 100644 --- a/packages/core/src/shell.ts +++ b/packages/core/src/shell.ts @@ -369,9 +369,11 @@ const layer = () => if (!oldest) break yield* removeCommand(oldest) } - // Cancel a pending timeout once the command exits on its own. Interrupting last avoids - // aborting finish when finish itself runs on the timeout fiber. - if (command.timeoutFiber) yield* Fiber.interrupt(command.timeoutFiber) + // Keep exited history data-only. Interrupt last because finish may run on the timeout fiber. + const timeoutFiber = command.timeoutFiber + command.timeout = undefined + command.timeoutFiber = undefined + if (timeoutFiber) yield* Fiber.interrupt(timeoutFiber) }) command.timeout = (duration) =>