Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afc07c5ac6 |
+6
-5
@@ -207,7 +207,7 @@ func RunApp(ctx context.Context, app *fx.App) error {
|
||||
var errReported = errors.New("operation failed")
|
||||
|
||||
// errInterrupted marks an operation that SIGINT or SIGTERM stopped
|
||||
// before it finished. Entry shows it and exits with exitCodeInterrupted.
|
||||
// before it finished. Entry shows it and returns exitCodeInterrupted.
|
||||
var errInterrupted = errors.New("interrupted before the command finished")
|
||||
|
||||
// RunOperation runs op against the Vaultik instance inside the fx app
|
||||
@@ -300,10 +300,11 @@ func RunOperation(
|
||||
return err
|
||||
}
|
||||
|
||||
// The goroutine sets failed or interrupted before triggering the
|
||||
// shutdown that lets RunWithApp return, so the write is in place by
|
||||
// the time we read it. If OnStop timed out, the goroutine has not
|
||||
// got that far, and OnStop has set interrupted itself.
|
||||
// RunWithApp returns only after OnStop has waited for the goroutine
|
||||
// to return, whether the shutdown came from op finishing or from an
|
||||
// interrupt, so the goroutine's write to failed or interrupted is in
|
||||
// place by the time we read it. If OnStop timed out, the goroutine
|
||||
// may still be running, and OnStop has set interrupted itself.
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user