git-svn-id: https://svn.kenai.com/svn/winsw~subversion/trunk@23 c8b2a3fe-9b5b-6a51-a37e-dc31b0e308fa
remotes/git-svn
jjasper4 2009-01-14 18:55:49 +00:00
parent cb3cff2dbe
commit 8fc1277776
1 changed files with 42 additions and 42 deletions

84
Main.cs
View File

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