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

Commit 5ea05eb

Browse files
committed
Solves proxy issue, closes #74 when proxy is set at .profile
1 parent 5bbc39f commit 5ea05eb

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
@@ -56,9 +56,9 @@ func sshCode(host, dir string, o options) error {
5656
dlScript := downloadScript(codeServerPath)
5757

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

61-
sshCmd := exec.Command("sh", "-c", sshCmdStr)
61+
sshCmd := exec.Command("sh", "-l", "-c", sshCmdStr)
6262
sshCmd.Stdout = os.Stdout
6363
sshCmd.Stderr = os.Stderr
6464
sshCmd.Stdin = strings.NewReader(dlScript)
@@ -99,7 +99,7 @@ func sshCode(host, dir string, o options) error {
9999
)
100100

101101
// Starts code-server and forwards the remote port.
102-
sshCmd = exec.Command("sh", "-c", sshCmdStr)
102+
sshCmd = exec.Command("sh", "-l", "-c", sshCmdStr)
103103
sshCmd.Stdin = os.Stdin
104104
sshCmd.Stdout = os.Stdout
105105
sshCmd.Stderr = os.Stderr
@@ -396,7 +396,7 @@ func parseHost(host string) (parsedHost string, additionalFlags string, err erro
396396
func parseGCPSSHCmd(instance string) (ip, sshFlags string, err error) {
397397
dryRunCmd := fmt.Sprintf("gcloud compute ssh --dry-run %v", instance)
398398

399-
out, err := exec.Command("sh", "-c", dryRunCmd).CombinedOutput()
399+
out, err := exec.Command("sh", "-l", "-c", dryRunCmd).CombinedOutput()
400400
if err != nil {
401401
return "", "", xerrors.Errorf("%s: %w", out, err)
402402
}

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)