From 1ea98a16b11864e1a81277732ec3ed690b5e0a95 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sun, 22 Mar 2020 11:39:09 +0100 Subject: [PATCH] cmd/syncthing: Don't open browser on upgrade restarts (fixes #6437) (#6442) We set the STRESTART environment when starting the inner process after the first time, but this didn't persist when restarting the monitor process. Now it does. --- cmd/syncthing/monitor.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/syncthing/monitor.go b/cmd/syncthing/monitor.go index 403e75404..238b4b65e 100644 --- a/cmd/syncthing/monitor.go +++ b/cmd/syncthing/monitor.go @@ -311,6 +311,11 @@ func copyStdout(stdout io.Reader, dst io.Writer) { } func restartMonitor(args []string) error { + // Set the STRESTART environment variable to indicate to the next + // process that this is a restart and not initial start. This prevents + // opening the browser on startup. + os.Setenv("STRESTART", "yes") + if runtime.GOOS != "windows" { // syscall.Exec is the cleanest way to restart on Unixes as it // replaces the current process with the new one, keeping the pid and