@@ -12,7 +12,6 @@ import (
12
12
"path/filepath"
13
13
"runtime"
14
14
"strconv"
15
- "strings"
16
15
"time"
17
16
18
17
"golang.org/x/xerrors"
@@ -47,7 +46,7 @@ More info: https://github.com/codercom/sshcode
47
46
48
47
dir := flag .Arg (1 )
49
48
if dir == "" {
50
- dir = "\\ ~"
49
+ dir = "~"
51
50
}
52
51
53
52
flog .Info ("ensuring code-server is updated..." )
@@ -59,15 +58,20 @@ More info: https://github.com/codercom/sshcode
59
58
"-tt" ,
60
59
host ,
61
60
`/bin/bash -c 'set -euxo pipefail || exit 1
62
- mkdir -p ~/bin
63
61
wget -q https://codesrv-ci.cdr.sh/latest-linux -O ` + codeServerPath + `
64
- chmod +x ` + codeServerPath + `
65
62
mkdir -p ~/.local/share/code-server
63
+ cd ` + filepath .Dir (codeServerPath )+ `
64
+ wget -N https://codesrv-ci.cdr.sh/latest-linux
65
+ [ -f ` + codeServerPath + ` ] && rm ` + codeServerPath + `
66
+ ln latest-linux ` + codeServerPath + `
67
+ chmod +x ` + codeServerPath + `
66
68
'` ,
67
69
)
68
- output , err := sshCmd .CombinedOutput ()
70
+ sshCmd .Stdout = os .Stdout
71
+ sshCmd .Stderr = os .Stderr
72
+ err := sshCmd .Run ()
69
73
if err != nil {
70
- flog .Fatal ("failed to update code-server: %v: %s " , err , output )
74
+ flog .Fatal ("failed to update code-server: %v" , err )
71
75
}
72
76
73
77
if ! (* skipSyncFlag ) {
@@ -93,9 +97,6 @@ mkdir -p ~/.local/share/code-server
93
97
flog .Fatal ("failed to find available port: %v" , err )
94
98
}
95
99
96
- // Escaped so interpreted by the remote shell, not local.
97
- dir = strings .Replace (dir , "~" , "\\ ~" , 1 )
98
-
99
100
sshCmdStr := fmt .Sprintf ("ssh -tt -q -L %v %v %v 'cd %v; %v --host 127.0.0.1 --allow-http --no-auth --port=%v'" ,
100
101
localPort + ":localhost:" + localPort , * sshFlags , host , dir , codeServerPath , localPort ,
101
102
)
0 commit comments