Skip to content

Conversation

@jkloetzke
Copy link
Member

If the user presses Ctrl+Z on the terminal, the kernel will send SIGTSTP to the current foreground process group. By default, this will directly stop all processes. But if we have messed with the terminal (e.g. disabled cursor), this will leave the terminal in a barely usable state.

Fix that by handling SIGTSTP and restore the original tty settings. If that is done, we can stop ourself. Upon resumption, re-initialize the tty and carry on.

If the user presses Ctrl+Z on the terminal, the kernel will send SIGTSTP
to the current foreground process group. By default, this will directly
stop all processes. But if we have messed with the terminal (e.g.
disabled cursor), this will leave the terminal in a barely usable state.

Fix that by handling SIGTSTP and restore the original tty settings. If
that is done, we can stop ourself. Upon resumption, re-initialize the
tty and carry on.
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 44.82759% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.25%. Comparing base (97b3aa2) to head (3957e86).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
pym/bob/tty.py 44.82% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #694      +/-   ##
==========================================
- Coverage   89.28%   89.25%   -0.03%     
==========================================
  Files          50       50              
  Lines       16422    16443      +21     
==========================================
+ Hits        14662    14676      +14     
- Misses       1760     1767       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jkloetzke jkloetzke merged commit a7e2791 into BobBuildTool:master Jan 19, 2026
9 of 11 checks passed
@jkloetzke jkloetzke deleted the restore-tty-on-stop branch January 19, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant