public void StartCapture() { var args = new MlaunchArguments { new SdkRootArgument(_processManager.XcodeRoot), new LogDevArgument(), new DeviceNameArgument(_deviceName), }; _process = new Process(); _process.StartInfo.FileName = _processManager.MlaunchPath; _process.StartInfo.Arguments = args.AsCommandLine(); _process.StartInfo.UseShellExecute = false; _process.StartInfo.RedirectStandardOutput = true; _process.StartInfo.RedirectStandardError = true; _process.StartInfo.RedirectStandardInput = true; _process.OutputDataReceived += (object sender, DataReceivedEventArgs e) => { if (e.Data != null) { return; } lock (_deviceLog) { _deviceLog.WriteLine(e.Data); } }; _process.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => { if (e.Data == null) { return; } lock (_deviceLog) { _deviceLog.WriteLine(e.Data); } }; _deviceLog.WriteLine("{0} {1}", _process.StartInfo.FileName, _process.StartInfo.Arguments); _process.Start(); _process.BeginOutputReadLine(); _process.BeginErrorReadLine(); }
public void MlaunchArgumentAndProcessManagerTest() { var oldArgs = new List <string>() { "--download-crash-report-to=/path/with spaces.txt", "--sdkroot", "/path to xcode/spaces", "--devname", "Premek's iPhone", }; var newArgs = new MlaunchArguments() { new DownloadCrashReportToArgument("/path/with spaces.txt"), new SdkRootArgument("/path to xcode/spaces"), new DeviceNameArgument("Premek's iPhone"), }; var oldWayOfPassingArgs = StringUtils.FormatArguments(oldArgs); var newWayOfPassingArgs = newArgs.AsCommandLine(); Assert.Equal(oldWayOfPassingArgs, newWayOfPassingArgs); }
public Task <ProcessExecutionResult> RunAsync(Process process, MlaunchArguments args, ILog log, TimeSpan?timeout = null, Dictionary <string, string> environment_variables = null, CancellationToken?cancellation_token = null, bool?diagnostics = null) { process.StartInfo.Arguments = args.AsCommandLine(); return(RunAsync(process, log, timeout, environment_variables, cancellation_token, diagnostics)); }