From d6457348af2736fa735dbcae0c47d765c17c1f9f Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 9 Oct 2019 16:35:50 +0200 Subject: [PATCH] Add exit code mgmt to modules --- modules/exit.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 modules/exit.go diff --git a/modules/exit.go b/modules/exit.go new file mode 100644 index 0000000..67d38bc --- /dev/null +++ b/modules/exit.go @@ -0,0 +1,16 @@ +package modules + +var ( + exitStatusCode int +) + +// SetExitStatusCode sets the exit code that the program shell return to the host after shutdown. +func SetExitStatusCode(n int) { + exitStatusCode = n +} + +// GetExitStatusCode waits for the shutdown to complete and then returns the exit code +func GetExitStatusCode() int { + <-shutdownCompleteSignal + return exitStatusCode +}