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

Commit 60b72fe

Browse files
committed
Revert behavior using DISPLAY to open app window
- 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.
1 parent 4bbf059 commit 60b72fe

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

sshcode.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const codeServerPath = "~/.cache/sshcode/sshcode-server"
2424
type options struct {
2525
skipSync bool
2626
syncBack bool
27+
noOpen bool
2728
localPort string
2829
remotePort string
2930
sshFlags string
@@ -130,7 +131,7 @@ func sshCode(host, dir string, o options) error {
130131

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

133-
if os.Getenv("DISPLAY") != "" {
134+
if !o.noOpen {
134135
openBrowser(url)
135136
}
136137

sshcode_test.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"io"
77
"net"
88
"net/http"
9-
"os"
109
"os/exec"
1110
"path/filepath"
1211
"strconv"
@@ -20,10 +19,6 @@ import (
2019
)
2120

2221
func TestSSHCode(t *testing.T) {
23-
// Avoid opening a browser window.
24-
err := os.Unsetenv("DISPLAY")
25-
require.NoError(t, err)
26-
2722
sshPort, err := randomPort()
2823
require.NoError(t, err)
2924

@@ -44,6 +39,7 @@ func TestSSHCode(t *testing.T) {
4439
sshFlags: testSSHArgs(sshPort),
4540
localPort: localPort,
4641
remotePort: remotePort,
42+
noOpen: true,
4743
})
4844
require.NoError(t, err)
4945
}()

0 commit comments

Comments
 (0)