Skip to content

Ctrl+Z can leave a stray suspended 'stty -echo' job from NMSh's prompt hook #206

Description

@raiseCatError

Observed

Under load, after suspending a job with Ctrl+Z, jobs can list an extra job:

[1]  - suspended (tty output)
[2]  + suspended  sleep 30

jobs -l and ps identify it as stty -echo in state TN (stopped by SIGTTOU). This was found while diagnosing the intermittent failure of the Ctrl+Z end-to-end test (JOBCOUNT=1), reproduced 6 times in 18 parallel runs.

Cause

NMSh's managed-zsh precmd hook runs stty -echo (and preexec runs stty echo) as ordinary commands with job control on. Right after a job stops, zsh can run the hook before it has taken the terminal back. stty then runs as a separate job, is stopped by SIGTTOU when it changes terminal modes, and stays in the user's job table.

Fix direction

Run those stty calls outside job control, with SIGTTOU ignored only for that call.

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

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions