Add automatic building of nethost for consoles
This commit is contained in:
@@ -320,6 +320,11 @@ namespace Flax.Build
|
||||
/// </summary>
|
||||
ConsoleLogOutput = 1 << 7,
|
||||
|
||||
/// <summary>
|
||||
/// Enables <see cref="ProcessStartInfo.UseShellExecute"/> to run process via Shell instead of standard process startup.
|
||||
/// </summary>
|
||||
Shell = 1 << 8,
|
||||
|
||||
/// <summary>
|
||||
/// The default options.
|
||||
/// </summary>
|
||||
@@ -398,11 +403,12 @@ namespace Flax.Build
|
||||
}
|
||||
|
||||
bool redirectStdOut = (options & RunOptions.NoStdOutRedirect) != RunOptions.NoStdOutRedirect;
|
||||
bool shell = options.HasFlag(RunOptions.Shell);
|
||||
|
||||
Process proc = new Process();
|
||||
proc.StartInfo.FileName = app;
|
||||
proc.StartInfo.Arguments = commandLine != null ? commandLine : "";
|
||||
proc.StartInfo.UseShellExecute = false;
|
||||
proc.StartInfo.UseShellExecute = shell;
|
||||
proc.StartInfo.RedirectStandardInput = input != null;
|
||||
proc.StartInfo.CreateNoWindow = true;
|
||||
|
||||
@@ -411,7 +417,7 @@ namespace Flax.Build
|
||||
proc.StartInfo.WorkingDirectory = workspace;
|
||||
}
|
||||
|
||||
if (redirectStdOut)
|
||||
if (redirectStdOut && !shell)
|
||||
{
|
||||
proc.StartInfo.RedirectStandardOutput = true;
|
||||
proc.StartInfo.RedirectStandardError = true;
|
||||
@@ -427,16 +433,24 @@ namespace Flax.Build
|
||||
}
|
||||
}
|
||||
|
||||
if (envVars != null)
|
||||
if (envVars != null && !shell)
|
||||
{
|
||||
foreach (var env in envVars)
|
||||
{
|
||||
if (env.Key == "PATH")
|
||||
{
|
||||
// Append to path
|
||||
proc.StartInfo.EnvironmentVariables[env.Key] = env.Value + ';' + proc.StartInfo.EnvironmentVariables[env.Key];
|
||||
}
|
||||
else if (env.Value == null)
|
||||
{
|
||||
// Remove variable
|
||||
if (proc.StartInfo.EnvironmentVariables.ContainsKey(env.Key))
|
||||
proc.StartInfo.EnvironmentVariables.Remove(env.Key);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set variable
|
||||
proc.StartInfo.EnvironmentVariables[env.Key] = env.Value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user