Skip to content

Refactor unix-only signal and dup2 handling into build-tagged files - #106

Merged
ernestrc merged 4 commits into
unstablebuild:mainfrom
ejb711:guard-unix-signals
Sep 30, 2026
Merged

ernestrc merged 4 commits into
unstablebuild:mainfrom
ejb711:guard-unix-signals

Conversation

@ejb711

@ejb711 ejb711 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Part of Windows support (#68, coordinated on #81). First of a few small slices that move unix-only
syscalls behind build tags so the tree compiles for GOOS=windows; graphics stay with #82.

cmd/rune/main.go referenced syscall.SIGURG and unix.Dup2, and the ssh workspace's signal map
referenced SIGUSR1/SIGUSR2. None of these exist on Windows, so both packages fail to compile
there.

The unix bodies move into !windows files unchanged. Windows gets small counterparts: SIGURG
never arrives, the launch log takes over the standard error handle with SetStdHandle (which the
runtime also consults for fatal writes, so crash output lands in the log too), and USR1/USR2 are
simply absent from the map.

Behavior on Linux and macOS is unchanged. New tests pin the SIGURG check and the forwarded user
signals.

After this, cmd/rune's only remaining Windows compile errors are detachFromTerminal and
presetStandardYAML, which #82 already provides in env_windows.go and
preset_standard_windows.go; workspacessh has none.

import "syscall"

func init() {
sigMap[syscall.SIGUSR1] = "USR1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than mutating the default map, I think it would be better if we just defined the full map here, and a signal_windows.go which what we need for windows. Reading std_remote.go no longer tells you what sigMap contains; worse, it leads you to think that that's the entire set.

Comment thread cmd/rune/signal_windows.go Outdated
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//go:build windows

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is redundant. _windows.go suffix already implies it

ejb711 and others added 2 commits September 30, 2026 11:48
cmd/rune/main.go referenced syscall.SIGURG and unix.Dup2, and the ssh workspace's
signal map referenced syscall.SIGUSR1 and SIGUSR2. None of these exist on Windows, so
both packages fail to compile there (unstablebuild#68).

Move them into !windows files unchanged. Windows gets its own small counterparts:
SIGURG never arrives, the launch log takes over the standard error handle with
SetStdHandle, which the runtime also uses for fatal writes, and USR1/USR2 are simply
absent from the map. Behavior on Linux and macOS is unchanged; new tests pin the SIGURG
check and the forwarded user signals.

Signed-off-by: Eric Brooks <[email protected]>
@ernestrc
ernestrc merged commit d5906dc into unstablebuild:main Sep 30, 2026
8 checks passed
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 21.42857% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/debug/pprof_unix.go 0.00% 7 Missing ⚠️
cmd/rune/main.go 0.00% 3 Missing ⚠️
cmd/rune/signal_unix.go 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

3 participants