lib/syncthing: Modify exit status before stopping (fixes #5869) (#5870)

This commit is contained in:
Simon Frei 2019-07-18 20:49:00 +02:00 committed by Jakob Borg
parent e7e177a6fa
commit 1894123d3c

View File

@ -407,14 +407,14 @@ func (a *App) Stop(stopReason ExitStatus) ExitStatus {
case <-a.stopped:
case <-a.stop:
default:
close(a.stop)
}
<-a.stopped
// ExitSuccess is the default value for a.exitStatus. If another status
// was already set, ignore the stop reason given as argument to Stop.
if a.exitStatus == ExitSuccess {
a.exitStatus = stopReason
}
close(a.stop)
<-a.stopped
}
return a.exitStatus
}