- Home /
Run fastlane process and redirect output
I've been trying to integrate fastlane to my workflow but I can't run and receive fastlane output in unity console.
This is the code I'm trying to run:
static StreamWriter messageStream;
static Process process = null;
[MenuItem("Setup/Fastlane/Details/Check newest build number from iTC")]
public static void CheckBuildNumberOniTC()
{
process = new Process();
process.StartInfo.WorkingDirectory = Path.GetFullPath("build/fastlane);
process.StartInfo.FileName = "/usr/local/bin/fastlane";
process.StartInfo.UseShellExecute = false;
// process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.OutputDataReceived += new DataReceivedEventHandler(DataReceived);
process.ErrorDataReceived += new DataReceivedEventHandler(ErrorReceived);
process.StartInfo.Arguments = "run app_store_build_number";
process.Start();
// StreamReader reader = process.StandardOutput;
// string output = reader.ReadToEnd();
// Console.WriteLine(output);
// process.WaitForExit();
// process.Close();
}
void OnApplicationQuit()
{
if (process != null && !process.HasExited)
{
process.Kill();
}
}
static void DataReceived(object sender, DataReceivedEventArgs eventArgs)
{
UnityEngine.Debug.Log(eventArgs.Data);
}
static void ErrorReceived(object sender, DataReceivedEventArgs eventArgs)
{
UnityEngine.Debug.LogError(eventArgs.Data);
}
I've tried the commented out version as well... What can be wrong?
Comment