github.com/safing/portbase@v0.19.5/modules/exit.go (about)

     1  package modules
     2  
     3  var exitStatusCode int
     4  
     5  // SetExitStatusCode sets the exit code that the program shell return to the host after shutdown.
     6  func SetExitStatusCode(n int) {
     7  	exitStatusCode = n
     8  }
     9  
    10  // GetExitStatusCode waits for the shutdown to complete and then returns the previously set exit code.
    11  func GetExitStatusCode() int {
    12  	<-shutdownCompleteSignal
    13  	return exitStatusCode
    14  }