diff --git a/Main.cs b/Main.cs index 938751e..b91ef7e 100644 --- a/Main.cs +++ b/Main.cs @@ -73,28 +73,28 @@ namespace winsw var n = dom.SelectSingleNode("//" + tagName); if (n == null) throw new InvalidDataException("<" + tagName + "> is missing in configuration XML"); return Environment.ExpandEnvironmentVariables(n.InnerText); - } - - /// - /// Path to the executable. - /// - public string Executable - { - get - { - return SingleElement("executable"); - } - } - - /// - /// Optionally specify a different Path to an executable to shutdown the service. - /// - public string StopExecutable - { - get - { - return AppendTags("stopexecutable"); - } + } + + /// + /// Path to the executable. + /// + public string Executable + { + get + { + return SingleElement("executable"); + } + } + + /// + /// Optionally specify a different Path to an executable to shutdown the service. + /// + public string StopExecutable + { + get + { + return AppendTags("stopexecutable"); + } } /// @@ -434,8 +434,8 @@ namespace winsw startarguments += " " + descriptor.Arguments; } - EventLog.WriteEntry("Starting " + descriptor.Executable + ' ' + startarguments); - + EventLog.WriteEntry("Starting " + descriptor.Executable + ' ' + startarguments); + StartProcess(process, startarguments, descriptor.Executable); // send stdout and stderr to its respective output file. @@ -463,18 +463,18 @@ namespace winsw } else { - stoparguments += " " + descriptor.Arguments; - - Process stopProcess = new Process(); - String executable = descriptor.StopExecutable; - - if (executable == null) - { - executable = descriptor.Executable; - } - - StartProcess(stopProcess, stoparguments, executable); -// stopProcess.WaitForExit(); + stoparguments += " " + descriptor.Arguments; + + Process stopProcess = new Process(); + String executable = descriptor.StopExecutable; + + if (executable == null) + { + executable = descriptor.Executable; + } + + StartProcess(stopProcess, stoparguments, executable); +// stopProcess.WaitForExit(); process.WaitForExit(); } } @@ -616,12 +616,12 @@ namespace winsw ThrowNoSuchService(); if(s.Started) - s.StopService(); - - while (s.Started) - { - Thread.Sleep(1000); - s = svc.Select(d.Id); + s.StopService(); + + while (s.Started) + { + Thread.Sleep(1000); + s = svc.Select(d.Id); } s.StartService();