Skip to content

[BUG] A lifecycle command script keeps running after Ctrl+C stops the APM command #3675

Closed

Description

Describe the bug

Lifecycle command scripts run in their own process group. When the user presses Ctrl+C while a script runs (for example the new pre-compile event), APM prints "Aborted!", exits 1 and releases its lifecycle lock, but the script process is not stopped. It keeps running and can write files after APM has exited. The docs say the script runs while the command holds APM's lifecycle lock.

To reproduce

  1. In apm.yml add a pre-compile command script: echo started > started.txt; sleep 8; echo late > .apm/instructions/late.instructions.md.
  2. apm lifecycle trust, then apm compile.
  3. Press Ctrl+C once started.txt exists, wait 10 seconds.

Expected behavior

Interrupting APM stops the running lifecycle script before APM exits, and the script log records the interruption.

Actual behavior

APM exits; about 4 seconds later the orphaned script writes .apm/instructions/late.instructions.md.

Found by the 0.36.0 pre-release lifecycle sweep, round 2 (#3649). The executor behavior predates 0.36 (pre/post-install scripts on v0.35.1); 0.36 adds the pre-compile event that reaches it.

Activity

  1. added
    area/cli
    type/bug
    pillar/foundations
    on Nov 12, 2026
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

    area/clipillar/foundationstype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions