adds a <hidewindow>true</hidewindow> config switch

so that launching bat files on legacy machines
running Interactive Services Detection don't balk.
pull/321/head
jeacott1 2019-05-28 13:25:17 +09:30
parent 79671f49d9
commit e2bf78f1df
5 changed files with 13 additions and 3 deletions

View File

@ -456,7 +456,8 @@ namespace winsw
priority: _descriptor.Priority,
callback: processCompletionCallback,
logHandler: logHandler,
redirectStdin: redirectStdin);
redirectStdin: redirectStdin,
hideWindow: _descriptor.HideWindow);
}
public static int Main(string[] args)

View File

@ -18,6 +18,7 @@ namespace winsw.Configuration
public string Caption { get { return null; } }
public string Description { get { return null; } }
public string Executable { get { return null; } }
public bool HideWindow { get { return false; } }
public string ExecutablePath
{

View File

@ -14,6 +14,7 @@ namespace winsw.Configuration
string Description { get; }
string Executable { get; }
string ExecutablePath { get; }
bool HideWindow { get; }
// Installation
bool AllowServiceAcountLogonRight { get; }

View File

@ -175,6 +175,13 @@ namespace winsw
}
}
public bool HideWindow
{
get {
return SingleBoolElement("hidewindow", Defaults.HideWindow);
}
}
/// <summary>
/// Optionally specify a different Path to an executable to shutdown the service.
/// </summary>

View File

@ -132,13 +132,13 @@ namespace winsw.Util
/// <param name="logHandler">Log handler. If enabled, logs will be redirected to the process and then reported</param>
/// <param name="redirectStdin">Redirect standard input</param>
public static void StartProcessAndCallbackForExit(Process processToStart, String executable = null, string arguments = null, Dictionary<string, string> envVars = null,
string workingDirectory = null, ProcessPriorityClass? priority = null, ProcessCompletionCallback callback = null, bool redirectStdin = true, LogHandler logHandler = null)
string workingDirectory = null, ProcessPriorityClass? priority = null, ProcessCompletionCallback callback = null, bool redirectStdin = true, LogHandler logHandler = null, bool hideWindow = false)
{
var ps = processToStart.StartInfo;
ps.FileName = executable ?? ps.FileName;
ps.Arguments = arguments ?? ps.Arguments;
ps.WorkingDirectory = workingDirectory ?? ps.WorkingDirectory;
ps.CreateNoWindow = false;
ps.CreateNoWindow = hideWindow;
ps.UseShellExecute = false;
ps.RedirectStandardInput = redirectStdin;
ps.RedirectStandardOutput = logHandler != null;