Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

Commit bbd94c5

Browse files
authored
Merge branch 'master' into reuse-ssh-connection
2 parents 1bc6ac0 + c637d40 commit bbd94c5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

sshcode.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ func sshCode(host, dir string, o options) error {
8080
dlScript := downloadScript(codeServerPath)
8181

8282
// Downloads the latest code-server and allows it to be executed.
83-
sshCmdStr := fmt.Sprintf("ssh %v %v '/usr/bin/env bash'", o.sshFlags, host)
83+
sshCmdStr := fmt.Sprintf("ssh %v %v '/usr/bin/env bash -l'", o.sshFlags, host)
8484

85-
sshCmd := exec.Command("sh", "-c", sshCmdStr)
85+
sshCmd := exec.Command("sh", "-l", "-c", sshCmdStr)
8686
sshCmd.Stdout = os.Stdout
8787
sshCmd.Stderr = os.Stderr
8888
sshCmd.Stdin = strings.NewReader(dlScript)
@@ -123,7 +123,7 @@ func sshCode(host, dir string, o options) error {
123123
)
124124

125125
// Starts code-server and forwards the remote port.
126-
sshCmd = exec.Command("sh", "-c", sshCmdStr)
126+
sshCmd = exec.Command("sh", "-l", "-c", sshCmdStr)
127127
sshCmd.Stdin = os.Stdin
128128
sshCmd.Stdout = os.Stdout
129129
sshCmd.Stderr = os.Stderr
@@ -533,7 +533,7 @@ func parseHost(host string) (parsedHost string, additionalFlags string, err erro
533533
func parseGCPSSHCmd(instance string) (ip, sshFlags string, err error) {
534534
dryRunCmd := fmt.Sprintf("gcloud compute ssh --dry-run %v", instance)
535535

536-
out, err := exec.Command("sh", "-c", dryRunCmd).CombinedOutput()
536+
out, err := exec.Command("sh", "-l", "-c", dryRunCmd).CombinedOutput()
537537
if err != nil {
538538
return "", "", xerrors.Errorf("%s: %w", out, err)
539539
}

sshcode_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func TestSSHCode(t *testing.T) {
4848
waitForSSHCode(t, remotePort, time.Second*30)
4949

5050
// Typically we'd do an os.Stat call here but the os package doesn't expand '~'
51-
out, err := exec.Command("sh", "-c", "stat "+codeServerPath).CombinedOutput()
51+
out, err := exec.Command("sh", "-l", "-c", "stat "+codeServerPath).CombinedOutput()
5252
require.NoError(t, err, "%s", out)
5353

5454
out, err = exec.Command("pkill", filepath.Base(codeServerPath)).CombinedOutput()
@@ -200,7 +200,7 @@ func handleSession(ch ssh.Channel, in <-chan *ssh.Request, t *testing.T) {
200200
return
201201
}
202202

203-
cmd := exec.Command("sh", "-c", exReq.Command)
203+
cmd := exec.Command("sh", "-l", "-c", exReq.Command)
204204

205205
stdin, err := cmd.StdinPipe()
206206
require.NoError(t, err)

0 commit comments

Comments
 (0)