Introduce StartAfterFunc

main
Brian Picciano 2 years ago
parent d0696182e1
commit 30159d80b2
  1. 11
      pmuxlib/proc.go

@ -48,6 +48,11 @@ type ProcessConfig struct {
// NoRestartOn indicates which exit codes should result in the process not
// being restarted any further.
NoRestartOn []int `yaml:"noRestartOn"`
// StartAfterFunc will cause the starting of the process to be blocked until
// this function returns. If used with RunProcessOnce and an error is
// returned, RunProcessOnce will return that error.
StartAfterFunc func(context.Context) error
}
func (cfg ProcessConfig) withDefaults() ProcessConfig {
@ -104,6 +109,12 @@ func RunProcessOnce(
cfg = cfg.withDefaults()
if cfg.StartAfterFunc != nil {
if err := cfg.StartAfterFunc(ctx); err != nil {
return -1, err
}
}
var wg sync.WaitGroup
fwdOutPipe := func(logger Logger, r io.Reader) {

Loading…
Cancel
Save