Created
August 5, 2013 22:58
-
-
Save rozgo/6160394 to your computer and use it in GitHub Desktop.
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 UnityEngine; | |
using System.Collections; | |
using System.IO; | |
public class ExecuteCommand : MonoBehaviour | |
{ | |
void Start () | |
{ | |
//string path = Directory.GetCurrentDirectory(); | |
string cmd = "git"; | |
string args = "diff Assets/Ammo/CannonBall.prefab"; | |
string result = Command(cmd, args); | |
Debug.Log(result); | |
} | |
public string Command (string command, string args) | |
{ | |
System.Diagnostics.ProcessStartInfo procStartInfo = | |
new System.Diagnostics.ProcessStartInfo (command, args); | |
procStartInfo.RedirectStandardOutput = true; | |
procStartInfo.UseShellExecute = false; | |
procStartInfo.CreateNoWindow = true; | |
System.Diagnostics.Process proc = new System.Diagnostics.Process (); | |
proc.StartInfo = procStartInfo; | |
proc.Start(); | |
string result = proc.StandardOutput.ReadToEnd(); | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment