restart service revisited

git-svn-id: https://svn.kenai.com/svn/winsw~subversion/trunk@22 c8b2a3fe-9b5b-6a51-a37e-dc31b0e308fa
remotes/git-svn
jjasper4 2009-01-07 21:13:29 +00:00
parent d42cf5188c
commit cb3cff2dbe
1 changed files with 13 additions and 3 deletions

16
Main.cs
View File

@ -474,7 +474,8 @@ namespace winsw
} }
StartProcess(stopProcess, stoparguments, executable); StartProcess(stopProcess, stoparguments, executable);
stopProcess.WaitForExit(); // stopProcess.WaitForExit();
process.WaitForExit();
} }
} }
@ -611,9 +612,18 @@ namespace winsw
} }
if (args[0] == "restart") if (args[0] == "restart")
{ {
if (s == null) ThrowNoSuchService(); if (s == null)
ThrowNoSuchService();
if(s.Started) if(s.Started)
s.StopService(); s.StopService();
while (s.Started)
{
Thread.Sleep(1000);
s = svc.Select(d.Id);
}
s.StartService(); s.StartService();
} }
if (args[0] == "status") if (args[0] == "status")