From 61442f88801cef1c6efe8ee0c435fc81b2e66ffe Mon Sep 17 00:00:00 2001 From: Provessor <26803851+Provessor@users.noreply.github.com> Date: Wed, 9 Sep 2020 21:08:52 +1000 Subject: [PATCH] A more robust server starting mechanism (#463) now lf will start the server in the current directory (which will then Chdir to the user's home directory) to ensure it is always starting as the user intended. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index d25918e..98ae65e 100644 --- a/main.go +++ b/main.go @@ -64,7 +64,6 @@ func exportEnvVars() { func startServer() { cmd := detachedCommand(os.Args[0], "-server") - cmd.Dir = gUser.HomeDir if err := cmd.Start(); err != nil { log.Printf("starting server: %s", err) } @@ -157,6 +156,7 @@ func main() { log.Fatalf("remote command: %s", err) } case *serverMode: + os.Chdir(gUser.HomeDir) gServerLogPath = filepath.Join(os.TempDir(), fmt.Sprintf("lf.%s.server.log", gUser.Username)) serve() default: