Skip to content

fix: enable job control for interactive shells on Unix - #48

Merged
taciturnaxolotl merged 1 commit into
masterfrom
fix/pty-job-control
Jul 30, 2026
Merged

fix: enable job control for interactive shells on Unix#48
taciturnaxolotl merged 1 commit into
masterfrom
fix/pty-job-control

Conversation

@taciturnaxolotl

@taciturnaxolotl taciturnaxolotl commented Jul 30, 2026

Copy link
Copy Markdown
Member

Interactive shells started over SSH were printing bash: no job control in this shell because child processes were not started in a new session with the PTY as their controlling terminal. This broke job control features like Ctrl+Z, bg, and fg.

The fix sets Setsid and Setctty on the child process's SysProcAttr before starting it, matching the behavior of creack/pty's StartWithAttrs.

Fixes #41

Start child processes in a new session with the PTY as controlling
terminal. Without this, bash prints "no job control in this shell"
and job control features like Ctrl+Z, bg, and fg do not work.

Co-authored-by: Pete Woods <email@pete-woods.com>
@coveralls

coveralls commented Jul 30, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 30503582511

Coverage decreased (-0.2%) to 62.158%

Details

  • Coverage decreased (-0.2%) from the base build.
  • Patch coverage: 5 uncovered changes across 1 file (0 of 5 lines covered, 0.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
pty_unix.go 5 0 0.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1242
Covered Lines: 772
Line Coverage: 62.16%
Coverage Strength: 8672.68 hits per line

💛 - Coveralls

@taciturnaxolotl
taciturnaxolotl merged commit 9acd60f into master Jul 30, 2026
10 checks passed
@taciturnaxolotl
taciturnaxolotl deleted the fix/pty-job-control branch July 30, 2026 00:48
taciturnaxolotl added a commit that referenced this pull request Jul 30, 2026
The job control change from #48 unconditionally set Setsid and Setctty
on every command started via Pty.Start, which broke callers that
manage their own SysProcAttr or run multiple commands sequentially
against the same PTY.

Job control is now opt-in via the new WithJobControl() option.
The default behavior matches the pre-#48 contract.
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.

Interactive shells cannot use job control

2 participants