Add a generic registerShutdown function for graceful exit (#2344)

* Add a generic registerShutdown function for graceful exit
* Add shutdown callback test case
This commit is contained in:
Anis Elleuch
2016-08-05 22:48:31 +02:00
committed by Harshavardhana
parent 62c0612eac
commit d28fb5fe23
7 changed files with 127 additions and 21 deletions

View File

@@ -189,6 +189,10 @@ func main() {
defer profile.Start(profile.BlockProfile, profile.ProfilePath(profileDir)).Stop()
}
// Initialize and monitor shutdown signal
shutdownSignal = make(chan bool, 1)
monitorShutdownSignal()
// Run the app - exit on error.
app.RunAndExitOnError()
}