From 17b24a022ff73fddbf20fa29904cb6e427deed88 Mon Sep 17 00:00:00 2001 From: vijayakrishnans Date: Sat, 14 Nov 2026 18:14:06 +0700 Subject: [PATCH] feat(release): ship Windows binaries (amd64, arm64) The GitHub release now carries orun__windows_{amd64,arm64}.zip with orun.exe, alongside the existing darwin and linux tarballs. To get there, `orun run --background` stops using the Unix-only Setpgid: process-group setup moves into command_run_background_unix.go (unchanged behaviour) and command_run_background_windows.go, which starts the detached run with CREATE_NEW_PROCESS_GROUP so a Ctrl+C in the launching console does not reach it. provider.yaml (the kiox OCI platforms) is unchanged; Windows ships through the GitHub release only. Verified: all six targets cross-compile, GOOS=windows go vet ./cmd/... is clean, go test ./cmd/orun/... passes, a goreleaser snapshot release produces both zips, and orun.exe runs `version` and `--help` on Windows. Co-Authored-By: Claude Opus 5.5 Signed-off-by: vijayakrishnans --- .goreleaser.yaml | 7 ++++++- cmd/orun/command_run_background.go | 3 +-- cmd/orun/command_run_background_unix.go | 11 +++++++++++ cmd/orun/command_run_background_windows.go | 11 +++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 cmd/orun/command_run_background_unix.go create mode 100644 cmd/orun/command_run_background_windows.go diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b9dc19a6..1b7957f6 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -13,13 +13,14 @@ builds: goos: - darwin - linux + - windows goarch: - amd64 - arm64 hooks: post: - mkdir -p dist/bin/{{ .Os }}/{{ .Arch }} - - cp {{ .Path }} dist/bin/{{ .Os }}/{{ .Arch }}/orun + - cp {{ .Path }} dist/bin/{{ .Os }}/{{ .Arch }}/orun{{ .Ext }} archives: - id: orun-archive @@ -27,6 +28,10 @@ archives: - orun formats: - tar.gz + format_overrides: + - goos: windows + formats: + - zip name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" checksum: diff --git a/cmd/orun/command_run_background.go b/cmd/orun/command_run_background.go index 4874969f..9b6f5a3e 100644 --- a/cmd/orun/command_run_background.go +++ b/cmd/orun/command_run_background.go @@ -6,7 +6,6 @@ import ( "os/exec" "path/filepath" "strings" - "syscall" "github.com/sourceplane/orun/internal/ui" ) @@ -54,7 +53,7 @@ func startBackgroundRun(execID string, color bool) error { "ORUN_EXEC_ID="+execID, "ORUN_NO_COLOR=1", ) - cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} + cmd.SysProcAttr = backgroundSysProcAttr() if err := cmd.Start(); err != nil { logFile.Close() diff --git a/cmd/orun/command_run_background_unix.go b/cmd/orun/command_run_background_unix.go new file mode 100644 index 00000000..8bfa34a2 --- /dev/null +++ b/cmd/orun/command_run_background_unix.go @@ -0,0 +1,11 @@ +//go:build unix + +package main + +import "syscall" + +// backgroundSysProcAttr puts the detached run in its own process group so a +// signal to the launching terminal does not reach it. +func backgroundSysProcAttr() *syscall.SysProcAttr { + return &syscall.SysProcAttr{Setpgid: true} +} diff --git a/cmd/orun/command_run_background_windows.go b/cmd/orun/command_run_background_windows.go new file mode 100644 index 00000000..f0ec0244 --- /dev/null +++ b/cmd/orun/command_run_background_windows.go @@ -0,0 +1,11 @@ +//go:build windows + +package main + +import "syscall" + +// backgroundSysProcAttr starts the detached run in a new process group so a +// Ctrl+C in the launching console does not reach it. +func backgroundSysProcAttr() *syscall.SysProcAttr { + return &syscall.SysProcAttr{CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP} +}