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

Solves proxy issue, closes #74 when proxy is set at .profile #121

Merged
merged 2 commits into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions sshcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func sshCode(host, dir string, o options) error {
dlScript := downloadScript(codeServerPath)

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

sshCmd := exec.Command("sh", "-c", sshCmdStr)
sshCmd := exec.Command("sh", "-l", "-c", sshCmdStr)
sshCmd.Stdout = os.Stdout
sshCmd.Stderr = os.Stderr
sshCmd.Stdin = strings.NewReader(dlScript)
Expand Down Expand Up @@ -99,7 +99,7 @@ func sshCode(host, dir string, o options) error {
)

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

out, err := exec.Command("sh", "-c", dryRunCmd).CombinedOutput()
out, err := exec.Command("sh", "-l", "-c", dryRunCmd).CombinedOutput()
if err != nil {
return "", "", xerrors.Errorf("%s: %w", out, err)
}
Expand Down
4 changes: 2 additions & 2 deletions sshcode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestSSHCode(t *testing.T) {
waitForSSHCode(t, remotePort, time.Second*30)

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

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

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

stdin, err := cmd.StdinPipe()
require.NoError(t, err)
Expand Down