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

Commit 91070f9

Browse files
committed
Move context outside of for loop, suppress ssh warnings
1 parent 126b411 commit 91070f9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ chmod +x ~/bin/code-server
5959
// Starts code-server and forwards the remote port.
6060
sshCmd = exec.Command("ssh",
6161
"-tt",
62+
"-q",
6263
"-L",
6364
localPort+":localhost:"+localPort,
6465
host,
@@ -81,7 +82,11 @@ chmod +x ~/bin/code-server
8182

8283
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
8384
defer cancel()
84-
for ctx.Err() == nil {
85+
for {
86+
err := ctx.Err()
87+
if err != nil {
88+
flog.Fatal("code-server didn't start in time %v", err)
89+
}
8590
// Waits for code-server to be available before opening the browser.
8691
r, _ := http.NewRequest("GET", url, nil)
8792
r = r.WithContext(ctx)

0 commit comments

Comments
 (0)