Skip to content

Architecture: Implement proper POSIX signal handling (SIGINT / SIGTSTP / SIGCHLD) #93

Description

@exlier

Problem

  • Signal handling is ad-hoc across the codebase. SIGINT/SIGTSTP are not consistently routed to the correct process group; SIGCHLD handling is incomplete, causing missed child status updates and occasional zombies.

Impact

  • Ctrl-C/Ctrl-Z behave inconsistently. Job control (fg/bg) is unreliable. Child processes may become zombies or their exit/stop/continue events are missed, causing incorrect job states.

How to reproduce

  • Run a foreground pipeline that spawns multiple processes and press Ctrl-C / Ctrl-Z repeatedly.
  • Start background jobs and rapidly start/stop others; check for zombies with ps or wait failures.

Acceptance criteria

  • Shell consistently manages process groups (setpgid/setsid and tcsetpgrp usage) so job control works like POSIX shells.
  • SIGCHLD is handled reliably: all child exits/stops/continues are observed and the internal job table is updated; no zombie processes are left.
  • No unsafe or non-async-safe functions are executed directly in signal handlers.
  • Include tests or a test harness that simulate multiple child lifecycles and validate behavior.

Activity

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