mirror of
https://github.com/datarhei/core.git
synced 2025-09-26 20:11:29 +08:00
Wait for process to exit when stopping
If a process has some cleanup with purge-on-delete defined, the purge has to wait until the process actually exited. Otherwise it may happen that the process got the signal, files are purged, but the process is still writing some files in order to exit cleanly. This would lead to some artefacts left on the filesystem.
This commit is contained in:
BIN
internal/testhelper/sigintwait/sigintwait
Executable file
BIN
internal/testhelper/sigintwait/sigintwait
Executable file
Binary file not shown.
18
internal/testhelper/sigintwait/sigintwait.go
Normal file
18
internal/testhelper/sigintwait/sigintwait.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Wait for interrupt signal to gracefully shutdown the app
|
||||
quit := make(chan os.Signal, 1)
|
||||
signal.Notify(quit, os.Interrupt)
|
||||
<-quit
|
||||
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
os.Exit(255)
|
||||
}
|
Reference in New Issue
Block a user