From f45267a6d46dcbf8fb383ed84eb57d90a9ed149a Mon Sep 17 00:00:00 2001 From: Rutik7066 Date: Tue, 4 Feb 2025 22:31:29 +0530 Subject: [PATCH] change path of sh Signed-off-by: Rutik7066 --- .gitignore | 4 +++- pkg/agent/ssh/server.go | 2 +- pkg/ide/vscode.go | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index a35eabfcdf..0662e3c053 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ DEV_WORKSPACES tmp -*.exe \ No newline at end of file +*.exe + +main \ No newline at end of file diff --git a/pkg/agent/ssh/server.go b/pkg/agent/ssh/server.go index ebb1467140..e706ef0a34 100644 --- a/pkg/agent/ssh/server.go +++ b/pkg/agent/ssh/server.go @@ -125,7 +125,7 @@ func (s *Server) handleNonPty(session ssh.Session) { args = append([]string{"-c"}, session.RawCommand()) } - cmd := exec.Command("/bin/sh", args...) + cmd := exec.Command("sh", args...) cmd.Env = append(cmd.Env, os.Environ()...) diff --git a/pkg/ide/vscode.go b/pkg/ide/vscode.go index 44462ed9e9..2b80121228 100644 --- a/pkg/ide/vscode.go +++ b/pkg/ide/vscode.go @@ -51,7 +51,12 @@ func OpenVSCode(activeProfile config.Profile, workspaceId, repoName string, work func setupVSCodeCustomizations(workspaceHostname string, workspaceProviderMetadata string, tool devcontainer.Tool, codeServerPath string, settingsPath string, lockFileName string) error { // Check if customizations are already set up - err := exec.Command("ssh", workspaceHostname, "test", "-f", fmt.Sprintf("$HOME/%s-%s", lockFileName, string(tool))).Run() + lockFileNamePath := fmt.Sprintf("$HOME/%s-%s", lockFileName, string(tool)) + if runtime.GOOS == "windows" { + lockFileNamePath = fmt.Sprintf("$HOME\\%s-%s", lockFileName, string(tool)) + } + + err := exec.Command("ssh", workspaceHostname, "test", "-f", lockFileNamePath).Run() if err == nil { return nil } @@ -129,7 +134,7 @@ func setupVSCodeCustomizations(workspaceHostname string, workspaceProviderMetada } // Create lock file to indicate that customizations are set up - err = exec.Command("ssh", workspaceHostname, "touch", fmt.Sprintf("$HOME/%s-%s", lockFileName, string(tool))).Run() + err = exec.Command("ssh", workspaceHostname, "touch", lockFileNamePath).Run() if err != nil { return err }