mirror of
https://github.com/golang/sys.git
synced 2026-01-29 07:02:06 +03:00
windows/svc/mgr: report exit status when querying services
One thing the newer notification API does not do is automatically provide the service exit code in its notifier response. It requires querying manually. Unfortunately, we weren't propagating this information up from the lower level struct, so this commit copys that information over. Change-Id: I70c683007ce34ffab6196329acefc8443f921ebe Reviewed-on: https://go-review.googlesource.com/c/sys/+/274577 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Trust: Alex Brainman <alex.brainman@gmail.com> Trust: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -68,8 +68,10 @@ func (s *Service) Query() (svc.Status, error) {
|
||||
return svc.Status{}, err
|
||||
}
|
||||
return svc.Status{
|
||||
State: svc.State(t.CurrentState),
|
||||
Accepts: svc.Accepted(t.ControlsAccepted),
|
||||
ProcessId: t.ProcessId,
|
||||
State: svc.State(t.CurrentState),
|
||||
Accepts: svc.Accepted(t.ControlsAccepted),
|
||||
ProcessId: t.ProcessId,
|
||||
Win32ExitCode: t.Win32ExitCode,
|
||||
ServiceSpecificExitCode: t.ServiceSpecificExitCode,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -71,11 +71,13 @@ const (
|
||||
|
||||
// Status combines State and Accepted commands to fully describe running service.
|
||||
type Status struct {
|
||||
State State
|
||||
Accepts Accepted
|
||||
CheckPoint uint32 // used to report progress during a lengthy operation
|
||||
WaitHint uint32 // estimated time required for a pending operation, in milliseconds
|
||||
ProcessId uint32 // if the service is running, the process identifier of it, and otherwise zero
|
||||
State State
|
||||
Accepts Accepted
|
||||
CheckPoint uint32 // used to report progress during a lengthy operation
|
||||
WaitHint uint32 // estimated time required for a pending operation, in milliseconds
|
||||
ProcessId uint32 // if the service is running, the process identifier of it, and otherwise zero
|
||||
Win32ExitCode uint32 // set if the service has exited with a win32 exit code
|
||||
ServiceSpecificExitCode uint32 // set if the service has exited with a service-specific exit code
|
||||
}
|
||||
|
||||
// ChangeRequest is sent to the service Handler to request service status change.
|
||||
|
||||
Reference in New Issue
Block a user