restart

package
v2.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryPath

func BinaryPath() (string, error)

BinaryPath returns the path to the binary that should be exec'd on restart. For daemon subprocesses (ZAPAROO_APP set), this is the original binary path. Otherwise it is the current executable path.

func Exec

func Exec() error

Exec replaces the current process with the updated binary. On Unix this uses syscall.Exec which atomically replaces the process (same PID). It does not return on success.

func ExecAfterRollback added in v2.17.0

func ExecAfterRollback(rollbackErr error) error

ExecAfterRollback re-execs the restored binary. A successful Exec never returns, so every return preserves the rollback error for diagnosis.

func ExecIfRequested

func ExecIfRequested(restartRequested func() bool) error

ExecIfRequested checks whether a restart was requested and, if so, re-execs the binary. Returns nil if no restart was requested. On success, the process is replaced (Unix) or a new process is spawned and the old one exits (Windows), so this function does not return on success.

func WaitForShutdown added in v2.17.0

func WaitForShutdown(
	sigs <-chan os.Signal,
	exit <-chan bool,
	done <-chan struct{},
	restartRequested func() bool,
	quit func(),
) <-chan bool

WaitForShutdown waits for whatever ends a run and calls quit, so a UI that owns the main thread lets go of it. The returned channel yields whether the process should re-exec into the binary that replaced it.

This has to run alongside the UI rather than after it. A tray or a terminal UI blocks its caller until the user closes it, and an update stops the service from underneath that loop. Waiting for the service afterwards means an installed update never restarts: the service shuts down, the UI stays up in front of nothing, and the new binary only runs if someone quits or reboots.

A nil done or sigs channel simply never fires, which is what a mode with no service of its own wants.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL