mirror of https://github.com/winsw/winsw
correct currentState required/test beep on success
git-svn-id: https://svn.kenai.com/svn/winsw~subversion/trunk@27 c8b2a3fe-9b5b-6a51-a37e-dc31b0e308faremotes/git-svn
parent
54c4a25951
commit
3b4052df0d
20
Main.cs
20
Main.cs
|
@ -571,7 +571,7 @@ namespace winsw
|
||||||
|
|
||||||
WaitForProcessToExit(process);
|
WaitForProcessToExit(process);
|
||||||
WaitForProcessToExit(stopProcess);
|
WaitForProcessToExit(stopProcess);
|
||||||
// Console.Beep();
|
Console.Beep();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,22 +581,34 @@ namespace winsw
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while (process.WaitForExit(3000))
|
while (process.WaitForExit(1000))
|
||||||
{
|
{
|
||||||
SignalShutdownPending();
|
SignalShutdownPending();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException)
|
catch (InvalidOperationException ex)
|
||||||
{
|
{
|
||||||
|
WriteEvent("already terminated", ex);
|
||||||
// already terminated
|
// already terminated
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SignalShutdownComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SignalShutdownPending()
|
private void SignalShutdownPending()
|
||||||
{
|
{
|
||||||
IntPtr handle = this.ServiceHandle;
|
IntPtr handle = this.ServiceHandle;
|
||||||
wrapperServiceStatus.checkPoint++;
|
wrapperServiceStatus.checkPoint++;
|
||||||
wrapperServiceStatus.waitHint = 5000;
|
wrapperServiceStatus.waitHint = 10000;
|
||||||
|
wrapperServiceStatus.currentState = (int)State.SERVICE_STOP_PENDING;
|
||||||
|
SetServiceStatus(handle, ref wrapperServiceStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SignalShutdownComplete()
|
||||||
|
{
|
||||||
|
IntPtr handle = this.ServiceHandle;
|
||||||
|
wrapperServiceStatus.checkPoint++;
|
||||||
|
wrapperServiceStatus.currentState = (int)State.SERVICE_STOPPED;
|
||||||
SetServiceStatus(handle, ref wrapperServiceStatus);
|
SetServiceStatus(handle, ref wrapperServiceStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue