diff --git a/selfupdate/restart_unix.go b/selfupdate/restart_unix.go index d4ceae0..20f812b 100644 --- a/selfupdate/restart_unix.go +++ b/selfupdate/restart_unix.go @@ -7,7 +7,7 @@ import ( "syscall" ) -// restart replaces this process with the new binary, with the same arguments and environment. -func restart(exe string) error { +// Restart replaces this process with the new binary, with the same arguments and environment. +func Restart(exe string) error { return syscall.Exec(exe, os.Args, os.Environ()) } diff --git a/selfupdate/restart_windows.go b/selfupdate/restart_windows.go index 1d0d2ba..8681be2 100644 --- a/selfupdate/restart_windows.go +++ b/selfupdate/restart_windows.go @@ -2,6 +2,6 @@ package selfupdate import "errors" -func restart(string) error { +func Restart(string) error { return errors.New("restarting in place is not supported on Windows") } diff --git a/selfupdate/selfupdate.go b/selfupdate/selfupdate.go index 457c20a..9662dbd 100644 --- a/selfupdate/selfupdate.go +++ b/selfupdate/selfupdate.go @@ -72,7 +72,7 @@ func (c *Config) defaults() { c.Verify = verifyRuns(c.App) } if c.Restart == nil { - c.Restart = restart + c.Restart = Restart } c.Server = strings.TrimRight(c.Server, "/") }