Skip to content

[FEATURE]: kill a shell command and keep its output (POST /api/shell/:id/kill, exited shells in the list) #62363

Open

Description

@cevr

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The only way to stop a shell command over the API is DELETE /api/shell/:id, which also drops its record and output. A client that wants to stop a runaway background command and then read what it printed (or show it as "killed" in a list) can't. GET /api/shell also lists running commands only, so a client can't show recently finished ones. Related: #56804 (a stuck shell nobody can clear), #60107.

Proposal:

  • POST /api/shell/:id/kill: SIGTERM to the process group, then SIGKILL to what's left after a short grace period (3 s on my fork). The record and output stay readable; it returns the terminal Shell.Info. ShellNotFoundError for an unknown id.
  • GET /api/shell?exited=true: also list the recently exited commands that are still retained, oldest first.
await client.shell.kill({ id })          // -> Shell.Info { status: "killed", ... }
await client.shell.output({ id })        // still readable
await client.shell.list({ exited: true })

A plugin or client can't build this today: there is no core Shell.kill that keeps the record, and shell.list filters exited commands out.

I have this working with tests on my fork: core in cevr@c965f99, the route, regenerated client and openapi, and the TUI shell tab using it in cevr@bb16af5. I can open a PR once the design is OK.

Activity

  1. opencodejr commented on Nov 6, 2026

    @opencodejr
    Contributor

    Thanks for the detailed proposal and for already having it working on your fork!

    To restate: you'd like a way to stop a shell command over the API while keeping its record and output (POST /api/shell/:id/kill, returning the terminal Shell.Info with status: "killed"), plus an option for GET /api/shell to also list recently exited shells that are still retained (?exited=true). Today DELETE /api/shell/:id drops the record, and list returns running commands only by design, so this is a new capability rather than a bug. It also can't be done as a plugin, because it needs a change in core Shell.

    Maintainers will look at the design and decide whether to take it. Please wait for their input on the API shape before opening the PR.

    Related issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions