mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-20 08:41:19 -08:00
clientupdate: don't exit tailscaled when starting the Windows installer
When an update is requested via LocalAPI, updateWindows runs inside tailscaled, and its os.Exit(0) after launching the tailscale.exe copy made the service restart the tailscaled child process immediately. Exit only when running as tailscale.exe. In tailscaled.exe, wait for the installer instead, which stops the service as part of the upgrade. As a side effect, an install that fails before stopping the service is now reported as a failed update. Updates tailscale/corp#40430 Change-Id: I8af60fa12740dafceb7c9ea4f50d87c1cad27fa4 Signed-off-by: Nick Khyl <[email protected]>
This commit is contained in:
1 file changed
+8
-1
@@ -159,7 +159,7 @@ you can run the command prompt as Administrator one of these ways:
|
||||
|
||||
up.Logf("making tailscale.exe copy to switch to...")
|
||||
up.cleanupOldDownloads(filepath.Join(os.TempDir(), updaterPrefix+"-*.exe"))
|
||||
_, cmdTailscaleCopy, err := makeCmdTailscaleCopy()
|
||||
cmdTailscale, cmdTailscaleCopy, err := makeCmdTailscaleCopy()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -174,6 +174,13 @@ you can run the command prompt as Administrator one of these ways:
|
||||
if err := cmd.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
if selfExe, err := os.Executable(); err == nil && selfExe != cmdTailscale {
|
||||
// We're tailscaled (the service's child process) rather
|
||||
// than tailscale (the CLI). If we exited now, the service
|
||||
// would restart us right away (see babysitProc in cmd/tailscaled),
|
||||
// so keep running until the installer stops the service.
|
||||
return cmd.Wait()
|
||||
}
|
||||
// Once it's started, exit ourselves, so the binary is free
|
||||
// to be replaced.
|
||||
os.Exit(0)
|
||||
|
||||
Reference in new issue
Block a user