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

Commit

Permalink
Revert behavior using DISPLAY to open app window
Browse files Browse the repository at this point in the history
- Previously the DISPLAY environment variable was consulted when
  determining whether to open a browser app window. However, it appears
  the environment variable isn't set in some supported environments, so
  the behavior has been updating to always open a window.
  • Loading branch information
sreya committed May 3, 2019
1 parent 4bbf059 commit 60b72fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 2 additions & 1 deletion sshcode.go
Expand Up @@ -24,6 +24,7 @@ const codeServerPath = "~/.cache/sshcode/sshcode-server"
type options struct {
skipSync bool
syncBack bool
noOpen bool
localPort string
remotePort string
sshFlags string
Expand Down Expand Up @@ -130,7 +131,7 @@ func sshCode(host, dir string, o options) error {

ctx, cancel = context.WithCancel(context.Background())

if os.Getenv("DISPLAY") != "" {
if !o.noOpen {
openBrowser(url)
}

Expand Down
6 changes: 1 addition & 5 deletions sshcode_test.go
Expand Up @@ -6,7 +6,6 @@ import (
"io"
"net"
"net/http"
"os"
"os/exec"
"path/filepath"
"strconv"
Expand All @@ -20,10 +19,6 @@ import (
)

func TestSSHCode(t *testing.T) {
// Avoid opening a browser window.
err := os.Unsetenv("DISPLAY")
require.NoError(t, err)

sshPort, err := randomPort()
require.NoError(t, err)

Expand All @@ -44,6 +39,7 @@ func TestSSHCode(t *testing.T) {
sshFlags: testSSHArgs(sshPort),
localPort: localPort,
remotePort: remotePort,
noOpen: true,
})
require.NoError(t, err)
}()
Expand Down

0 comments on commit 60b72fe

Please sign in to comment.