From c7fc7b91ec5cd7f108022ad3c511fa77c94f427e Mon Sep 17 00:00:00 2001 From: Ethan <39577870+ethanndickson@users.noreply.github.com> Date: Thu, 1 May 2025 16:53:13 +1000 Subject: [PATCH] fix: create directory before writing coder connect network info file (#17628) The regular network info file creation code also calls `Mkdirall`. Wasn't picked up in manual testing as I already had the `/net` folder in my VSCode. Wasn't picked up in automated testing because we use an in-memory FS, which for some reason does this implicitly. --- cli/ssh.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cli/ssh.go b/cli/ssh.go index f9cc1be14c..7c5bda073f 100644 --- a/cli/ssh.go +++ b/cli/ssh.go @@ -1542,6 +1542,10 @@ func writeCoderConnectNetInfo(ctx context.Context, networkInfoDir string) error if !ok { fs = afero.NewOsFs() } + if err := fs.MkdirAll(networkInfoDir, 0o700); err != nil { + return xerrors.Errorf("mkdir: %w", err) + } + // The VS Code extension obtains the PID of the SSH process to // find the log file associated with a SSH session. //