Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: redirect the user to the home directory if dir is not set
This was blocking SSH connections from being established if a dir
that wasn't created yet is set.
  • Loading branch information
kylecarbs committed Feb 7, 2023
commit 39de1228021a444cffe1b747a0211e293c12a417
6 changes: 5 additions & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,11 @@ func (a *agent) createCommand(ctx context.Context, rawCommand string, env []stri

cmd := exec.CommandContext(ctx, shell, args...)
cmd.Dir = metadata.Directory
if cmd.Dir == "" {

// If the metadata directory doesn't exist, we run the command
// in the users home directory.
_, err = os.Stat(cmd.Dir)
if cmd.Dir == "" || err != nil {
// Default to user home if a directory is not set.
homedir, err := userHomeDir()
if err != nil {
Expand Down