From cb3cff2dbe57660cb56ef39a813f04e5deea4def Mon Sep 17 00:00:00 2001 From: jjasper4 Date: Wed, 7 Jan 2009 21:13:29 +0000 Subject: [PATCH] restart service revisited git-svn-id: https://svn.kenai.com/svn/winsw~subversion/trunk@22 c8b2a3fe-9b5b-6a51-a37e-dc31b0e308fa --- Main.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Main.cs b/Main.cs index f5f6325..938751e 100644 --- a/Main.cs +++ b/Main.cs @@ -474,7 +474,8 @@ namespace winsw } StartProcess(stopProcess, stoparguments, executable); - stopProcess.WaitForExit(); +// stopProcess.WaitForExit(); + process.WaitForExit(); } } @@ -611,9 +612,18 @@ namespace winsw } if (args[0] == "restart") { - if (s == null) ThrowNoSuchService(); + if (s == null) + ThrowNoSuchService(); + if(s.Started) - s.StopService(); + s.StopService(); + + while (s.Started) + { + Thread.Sleep(1000); + s = svc.Select(d.Id); + } + s.StartService(); } if (args[0] == "status")