1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Added support for shell commands in postbuild/prebuild

This commit is contained in:
Brian Fiete 2020-01-23 07:44:09 -08:00
parent 480f909cec
commit ddc943876d
2 changed files with 22 additions and 2 deletions

View file

@ -7267,7 +7267,13 @@ namespace IDE
} }
} }
public ExecutionInstance DoRun(String inFileName, String args, String workingDir, ArgsFileKind useArgsFile, Dictionary<String, String> envVars = null, String stdInData = null) public enum RunFlags
{
None,
ShellCommand = 1
}
public ExecutionInstance DoRun(String inFileName, String args, String workingDir, ArgsFileKind useArgsFile, Dictionary<String, String> envVars = null, String stdInData = null, RunFlags runFlags = .None)
{ {
//Debug.Assert(executionInstance == null); //Debug.Assert(executionInstance == null);
@ -7285,6 +7291,18 @@ namespace IDE
if (stdInData != null) if (stdInData != null)
startInfo.RedirectStandardInput = true; startInfo.RedirectStandardInput = true;
startInfo.CreateNoWindow = true; startInfo.CreateNoWindow = true;
if (runFlags.HasFlag(.ShellCommand))
{
String shellArgs = scope .();
shellArgs.Append("/c ");
IDEUtils.AppendWithOptionalQuotes(shellArgs, fileName);
shellArgs.Append(" ");
shellArgs.Append(args);
startInfo.SetFileName("cmd.exe");
startInfo.SetArguments(shellArgs);
}
if (envVars != null) if (envVars != null)
{ {
for (var envKV in envVars) for (var envKV in envVars)

View file

@ -1301,7 +1301,9 @@ namespace IDE
{ {
var exeArgs = scope String(); var exeArgs = scope String();
exeArgs.Append(cmd, spacePos + 1); exeArgs.Append(cmd, spacePos + 1);
gApp.DoRun(exePath, exeArgs, gApp.mInstallDir, .None);
bool wantsShellCommand = !exePath.EndsWith(".exe", .OrdinalIgnoreCase);
gApp.DoRun(exePath, exeArgs, gApp.mInstallDir, .None, null, null, wantsShellCommand ? .ShellCommand : .None);
} }
} }