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

Revert behavior using DISPLAY to open app window #90

Merged
merged 1 commit into from
May 3, 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
3 changes: 2 additions & 1 deletion sshcode.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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