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

Commit

Permalink
Merge pull request #121 from eargollo/proxy-support
Browse files Browse the repository at this point in the history
Solves proxy issue, closes #74 when proxy is set at .profile
  • Loading branch information
deansheather authored Jun 27, 2019
2 parents 8c07a08 + 2f52cef commit c637d40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
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

0 comments on commit c637d40

Please sign in to comment.