Created
May 19, 2014 22:46
-
-
Save Ravadre/88092df5064b9182e051 to your computer and use it in GitHub Desktop.
Test args
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
using System; | |
class Program | |
{ | |
public static bool IsRunningOnMono() | |
{ | |
return Type.GetType("Mono.Runtime") != null; | |
} | |
static void Main(string[] args) | |
{ | |
if (args.Length > 0) | |
{ | |
Console.WriteLine("Raw:"); | |
Console.WriteLine(Environment.CommandLine); | |
Console.WriteLine(); | |
Console.WriteLine("Parsed:"); | |
for (int i = 1; i <= args.Length; ++i) | |
{ | |
System.Console.WriteLine("Args[" + i + "]:" + args[i - 1]); | |
} | |
return; | |
} | |
var proc = new Process | |
{ | |
StartInfo = new ProcessStartInfo | |
{ | |
FileName = IsRunningOnMono() ? "StripArgsTest.sh" : "StripArgsTest.exe", | |
Arguments = ": /home/administrator/Projects/UnrealEngine.sbc100/Engine/Binaries/Linux/UE4Editor \"/home/administrator/Documents/Unreal Projects/TappyChicken/TappyChicken.uproject\" -run=Cook -Map=/Game/Maps/TappyChickenMap -TargetPlatform=LinuxNoEditor -buildmachine -Unversioned -fileopenlog -abslog=\"/home/administrator/Library/Logs/Unreal Engine/LocalBuildLogs/Cook.txt\" -stdout -FORCELOGFLUSH -CrashForUAT -unattended -AllowStd", | |
UseShellExecute = false, | |
RedirectStandardOutput = true, | |
CreateNoWindow = true | |
} | |
}; | |
proc.Start(); | |
while (!proc.StandardOutput.EndOfStream) | |
{ | |
string line = proc.StandardOutput.ReadLine(); | |
// do something with line | |
System.Console.WriteLine(line); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment