@@ -19,6 +19,8 @@ import (
1919 "golang.org/x/xerrors"
2020)
2121
22+ const codeServerPath = "~/.cache/sshcode/sshcode-server"
23+
2224type options struct {
2325 skipSync bool
2426 syncBack bool
@@ -30,8 +32,6 @@ type options struct {
3032func sshCode (host , dir string , o options ) error {
3133 flog .Info ("ensuring code-server is updated..." )
3234
33- const codeServerPath = "/tmp/sshcode-code-server"
34-
3535 dlScript := downloadScript (codeServerPath )
3636
3737 // Downloads the latest code-server and allows it to be executed.
@@ -97,7 +97,7 @@ func sshCode(host, dir string, o options) error {
9797 sshCmd .Stderr = os .Stderr
9898 err = sshCmd .Start ()
9999 if err != nil {
100- flog . Fatal ("failed to start code-server: %v " , err )
100+ return xerrors . Errorf ("failed to start code-server: %w " , err )
101101 }
102102
103103 url := "http://127.0.0.1:" + o .localPort
@@ -313,12 +313,13 @@ func downloadScript(codeServerPath string) string {
313313 return fmt .Sprintf (
314314 `set -euxo pipefail || exit 1
315315
316- mkdir -p ~/.local/share/code-server
316+ mkdir -p ~/.local/share/code-server %v
317317cd %v
318318wget -N https://codesrv-ci.cdr.sh/latest-linux
319319[ -f %v ] && rm %v
320320ln latest-linux %v
321321chmod +x %v` ,
322+ filepath .Dir (codeServerPath ),
322323 filepath .Dir (codeServerPath ),
323324 codeServerPath ,
324325 codeServerPath ,
0 commit comments