Skip to content

Commit 40e96b5

Browse files
authoredJan 15, 2025··
exec(test): Do not clear PATH; this breaks coverage on Windows (#2150)
## Changes When setting up PATH in tests, put desired entry first but keep the rest as well. Otherwise it fails on Windows ``` D:/a/cli/cli/libs/exec/exec_test.go:108 Error: Received unexpected error: exit status 0xc0000135 ``` Explanation from Claude: > The error code 0xc0000135 is a Windows error indicating "Unable to locate DLL" > When code coverage is enabled, Go instruments the binary with coverage tracking code, which requires additional DLL dependencies on Windows. ## Tests Separate draft PR with coverage enabled on CI: #2141
·
v0.260.0snapshot
1 parent 983a8a6 commit 40e96b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎libs/exec/exec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func testExecutorWithShell(t *testing.T, shell string) {
8585

8686
// Create temporary directory with only the shell executable in the PATH.
8787
tmpDir := t.TempDir()
88-
t.Setenv("PATH", tmpDir)
88+
t.Setenv("PATH", fmt.Sprintf("%s%c%s", tmpDir, os.PathListSeparator, os.Getenv("PATH")))
8989
if runtime.GOOS == "windows" {
9090
err = os.Symlink(p, fmt.Sprintf("%s/%s.exe", tmpDir, shell))
9191
require.NoError(t, err)

0 commit comments

Comments
 (0)
Please sign in to comment.