Skip to content

Commit

Permalink
fix: use dir over full path for coder bin (#1795)
Browse files Browse the repository at this point in the history
  • Loading branch information
f0ssel committed May 26, 2022
1 parent 7b39352 commit 781f3d0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func (a *agent) createCommand(ctx context.Context, rawCommand string, env []stri
if err != nil {
return nil, xerrors.Errorf("getting os executable: %w", err)
}
cmd.Env = append(cmd.Env, fmt.Sprintf(`PATH=%s%c%s`, os.Getenv("PATH"), filepath.ListSeparator, executablePath))
cmd.Env = append(cmd.Env, fmt.Sprintf(`PATH=%s%c%s`, os.Getenv("PATH"), filepath.ListSeparator, filepath.Dir(executablePath)))
// Git on Windows resolves with UNIX-style paths.
// If using backslashes, it's unable to find the executable.
unixExecutablePath := strings.ReplaceAll(executablePath, "\\", "/")
Expand Down
2 changes: 1 addition & 1 deletion agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestAgent(t *testing.T) {
ex, err := os.Executable()
t.Log(ex)
require.NoError(t, err)
require.True(t, strings.Contains(strings.TrimSpace(string(output)), ex), string(output), ex)
require.True(t, strings.Contains(strings.TrimSpace(string(output)), filepath.Dir(ex)))
})

t.Run("SessionTTY", func(t *testing.T) {
Expand Down

0 comments on commit 781f3d0

Please sign in to comment.