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.
This commit is contained in:
parent
ec512dfe31
commit
61442f8880
2
main.go
2
main.go
@ -64,7 +64,6 @@ func exportEnvVars() {
|
|||||||
|
|
||||||
func startServer() {
|
func startServer() {
|
||||||
cmd := detachedCommand(os.Args[0], "-server")
|
cmd := detachedCommand(os.Args[0], "-server")
|
||||||
cmd.Dir = gUser.HomeDir
|
|
||||||
if err := cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
log.Printf("starting server: %s", err)
|
log.Printf("starting server: %s", err)
|
||||||
}
|
}
|
||||||
@ -157,6 +156,7 @@ func main() {
|
|||||||
log.Fatalf("remote command: %s", err)
|
log.Fatalf("remote command: %s", err)
|
||||||
}
|
}
|
||||||
case *serverMode:
|
case *serverMode:
|
||||||
|
os.Chdir(gUser.HomeDir)
|
||||||
gServerLogPath = filepath.Join(os.TempDir(), fmt.Sprintf("lf.%s.server.log", gUser.Username))
|
gServerLogPath = filepath.Join(os.TempDir(), fmt.Sprintf("lf.%s.server.log", gUser.Username))
|
||||||
serve()
|
serve()
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user