Skip to content

One Ctrl-C does not stop a line of joined bounded commands #69

Closed

Description

@sourcehawk

Problem

One Ctrl-C does not stop a line of joined wrapper calls. bounding-heavy-commands (#56) asks the user to run one line that joins a wrapper call per command with ;. When the user presses Ctrl-C, the wrapper that runs at that moment catches the signal, cleans up, and exits normally with code 130. The shell then sees an ordinary exit, not a death by signal, and starts the next wrapper call. The user has to press Ctrl-C one time for each command in the line.

Approach

After its cleanup, a wrapper that was stopped by SIGINT (or by another stop signal that it forwards) restores the default handler and sends the same signal to itself, so it dies from the signal. A shell then stops a joined line, as it does for any command that SIGINT ends. The exit code seen by a caller that reads $? stays 130.

Acceptance criteria

  • A process test: a line wrapper -- <long command>; touch <file> run under sh -c and sent SIGINT does not create the file.
  • The exit status of the wrapper after SIGINT is still 130 for a caller.
  • A stop while the wrapper waits in the queue behaves the same way.
  • The tests pass on Linux and macOS.

Context

Found while building #56 (PR #63).

Activity

  1. added 4 commits that reference this issue on Sep 30, 2026
    b89df3b
    9b2416b
    5f74532
    c161cb0
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions