Skip to content

Commit f6effdb

Browse files
authored
fix: redirect the user to the home directory if dir is not set (coder#6085)
This was blocking SSH connections from being established if a dir that wasn't created yet is set.
1 parent bde4ffe commit f6effdb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

agent/agent.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,11 @@ func (a *agent) createCommand(ctx context.Context, rawCommand string, env []stri
803803

804804
cmd := exec.CommandContext(ctx, shell, args...)
805805
cmd.Dir = metadata.Directory
806-
if cmd.Dir == "" {
806+
807+
// If the metadata directory doesn't exist, we run the command
808+
// in the users home directory.
809+
_, err = os.Stat(cmd.Dir)
810+
if cmd.Dir == "" || err != nil {
807811
// Default to user home if a directory is not set.
808812
homedir, err := userHomeDir()
809813
if err != nil {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy