Skip to content

Fix PATH setup on Windows and skip the login-shell PATH probe there - #115

Merged
ernestrc merged 2 commits into
unstablebuild:mainfrom
ejb711:fix-windows-env-path
Sep 30, 2026
Merged

ernestrc merged 2 commits into
unstablebuild:mainfrom
ejb711:fix-windows-env-path

Conversation

@ejb711

@ejb711 ejb711 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Part of Windows support (#68, coordinated on #81). Found by running a locally built rune.exe on
Windows 11; graphics stay with #82.

setRuneBinPATH joined the managed bin directory onto PATH with :, which on Windows fuses it
with the first entry instead of adding a new one. It now joins with os.PathListSeparator through
a small pure helper; on Linux and macOS the result is byte-identical to before.

The login-shell PATH probe runs a POSIX script with -i -l -c and /usr/bin/env, which cannot
succeed on Windows and spent up to its 10 s timeout on every launch. It moves to a !windows file
unchanged; on Windows, which has no login shell that extends PATH, the current PATH is used.

Tests: TestPrependPATH covers both separators and the empty base; the existing PATH test no longer
assumes :; a Windows-tagged test pins that the shell probe is never consulted there. The files are
named login_path_* to avoid an add/add conflict with #82's env_windows.go; once this lands,
#82's detachFromTerminal stub is no longer needed.

@codecov

codecov Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.18519% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/rune/login_path_unix.go 87.50% 2 Missing and 1 partial ⚠️
cmd/rune/env.go 66.66% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Comment thread cmd/rune/env_test.go

// TestSetupManagedBinPathPrependsBinDirOnce asserts that setupManagedBinPath
// creates the managed dirs and prepends the bin dir to PATH exactly once.
func TestPrependPATH(t *testing.T) {

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.

the comment above is incorrect now. Move this test 3 lines up

@ernestrc
ernestrc force-pushed the fix-windows-env-path branch from 4ee6aa9 to b11e817 Compare September 30, 2026 14:30
ejb711 and others added 2 commits September 30, 2026 16:31
setRuneBinPATH joined the managed bin directory onto PATH with ':', which on Windows
fuses it with the first entry instead of adding a new one. Join with
os.PathListSeparator instead.

The login-shell PATH probe runs a POSIX script with -i -l -c and /usr/bin/env, which
cannot succeed on Windows and spent up to its 10 s timeout on every launch. Move it to
a !windows file unchanged; on Windows, which has no login shell that extends PATH,
resolve to the current PATH instead.

Linux and macOS are unchanged. TestPrependPATH covers both separators, and the
existing PATH test no longer assumes ':' (unstablebuild#68).

Signed-off-by: Eric Brooks <[email protected]>
…solve

The login shell inherits Rune's PATH, which already starts with the bin dir.
Shells that keep inherited entries (macOS path_helper, the Windows resolver)
hand it back, so the prepend ran twice. prependPATH now drops entries naming
the bin dir, compared per platform syntax, and keeps every other entry
verbatim, including empty entries and Windows quoting.

Co-Authored-By: Rune Agent (claude/claude-opus-5-5) <[email protected]>
Signed-off-by: ernestrc <[email protected]>
@ernestrc
ernestrc force-pushed the fix-windows-env-path branch from b11e817 to 206e6de Compare September 30, 2026 14:35
@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 96.15385% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/rune/login_path_unix.go 90.47% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ernestrc
ernestrc merged commit 52aaec4 into unstablebuild:main Sep 30, 2026
8 checks passed
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