Skip to content

Send service to foreground/background on PTY attach/detach - #165

Draft
bjorn3 wants to merge 10 commits into
fdstore_to_ptystorefrom
monitor
Draft

bjorn3 wants to merge 10 commits into
fdstore_to_ptystorefrom
monitor

Conversation

@bjorn3

@bjorn3 bjorn3 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

This introduces a monitor process to be used when a PTY is used. This monitor process is the session leader for the service, allowing it to set the foreground process group of the service PTY. beam-init will forward any api commands to the monitor process as necessary.

Fixes #117

@bjorn3
bjorn3 added this pull request to stack #166 September 16, 2026 13:16
Base automatically changed from raw_mode to main September 17, 2026 08:00
@bjorn3
bjorn3 force-pushed the monitor branch 2 times, most recently from 3361ad4 to 3433dbf Compare September 17, 2026 15:00
@squell

squell commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Changes look reasonable to me (maybe IpcBarrierWaiter is deserving of a bit more documentation; i.e. answering the why question in particular).

I've tested it and so far I get some confusing results where the 'SIGTSTP' seems to arrive later than the SIGCONT upon a beamctl attach, using this test program:

#! /bin/dash
FOO=H
trap "FOO=A" CONT
trap "FOO=B" TSTP
while true; do sleep 1; echo $FOO; done

@bjorn3
bjorn3 force-pushed the monitor branch 3 times, most recently from b0128f5 to 551f4d6 Compare September 21, 2026 13:51
@bjorn3
bjorn3 removed this pull request from stack #166 September 21, 2026 13:52
@bjorn3
bjorn3 changed the base branch from main to fdstore_to_ptystore September 21, 2026 13:52
@bjorn3
bjorn3 added this pull request to stack #172 September 21, 2026 13:53
We no longer send SIGWINCH on PTY attach. And SIGWINCH during actual
window resizing is non-trivial to test in our test framework.
old_sigset.set_mask() probably already unmasked it for the child, but
just to be on the safe side and be clearer move SIGTTOU after forking.
FIXME notify beamctl on backgrounding
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.

Send process groups to the background upon detach

2 participants