diff options
Diffstat (limited to 'modules/graceful/restart_unix.go')
-rw-r--r-- | modules/graceful/restart_unix.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/modules/graceful/restart_unix.go b/modules/graceful/restart_unix.go index 406fe6c8af..a7c2b8288a 100644 --- a/modules/graceful/restart_unix.go +++ b/modules/graceful/restart_unix.go @@ -16,6 +16,7 @@ import ( "strings" "sync" "syscall" + "time" ) var killParent sync.Once @@ -70,11 +71,20 @@ func RestartProcess() (int, error) { // Pass on the environment and replace the old count key with the new one. var env []string for _, v := range os.Environ() { - if !strings.HasPrefix(v, listenFDs+"=") { + if !strings.HasPrefix(v, listenFDsEnv+"=") { env = append(env, v) } } - env = append(env, fmt.Sprintf("%s=%d", listenFDs, len(listeners))) + env = append(env, fmt.Sprintf("%s=%d", listenFDsEnv, len(listeners))) + + if notifySocketAddr != "" { + env = append(env, fmt.Sprintf("%s=%s", notifySocketEnv, notifySocketAddr)) + } + + if watchdogTimeout != 0 { + watchdogStr := strconv.FormatInt(int64(watchdogTimeout/time.Millisecond), 10) + env = append(env, fmt.Sprintf("%s=%s", watchdogTimeoutEnv, watchdogStr)) + } sb := &strings.Builder{} for i, unlink := range getActiveListenersToUnlink() { @@ -87,7 +97,7 @@ func RestartProcess() (int, error) { unlinkStr := sb.String() if len(unlinkStr) > 0 { unlinkStr = unlinkStr[:len(unlinkStr)-1] - env = append(env, fmt.Sprintf("%s=%s", unlinkFDs, unlinkStr)) + env = append(env, fmt.Sprintf("%s=%s", unlinkFDsEnv, unlinkStr)) } allFiles := append([]*os.File{os.Stdin, os.Stdout, os.Stderr}, files...) |