minwinsvc.go 662 B

123456789101112131415161718
  1. // Copyright 2015 Daniel Theophanes.
  2. // Use of this source code is governed by a zlib-style
  3. // license that can be found in the LICENSE file.package service
  4. // Minimal non-invasive windows only service stub.
  5. //
  6. // Import to allow running as a windows service.
  7. // import _ "github.com/kardianos/minwinsvc"
  8. // This will detect if running as a windows service
  9. // and install required callbacks for windows.
  10. package minwinsvc
  11. // SetOnExit sets the function to be called when the windows service
  12. // requests an exit. If this is not called, or if it is called where
  13. // f == nil, then it defaults to calling "os.Exit(0)".
  14. func SetOnExit(f func()) {
  15. setOnExit(f)
  16. }