当前位置: 首页>>代码示例>>C#>>正文


C# Process.BeginErrorReadLine方法代码示例

本文整理汇总了C#中Process.BeginErrorReadLine方法的典型用法代码示例。如果您正苦于以下问题:C# Process.BeginErrorReadLine方法的具体用法?C# Process.BeginErrorReadLine怎么用?C# Process.BeginErrorReadLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Process的用法示例。


在下文中一共展示了Process.BeginErrorReadLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyShader

    static bool ApplyShader(string test_name, string shader, string input, string result, string extra)
    {
        Process applyShader = new Process ();
        applyShader.StartInfo.FileName = "mono";
        applyShader.StartInfo.UseShellExecute = false;
        applyShader.StartInfo.Arguments = string.Format ("../src/shader.exe {0} {1} {2} {3}", extra, shader, input, result);
        applyShader.StartInfo.RedirectStandardError = true;
        applyShader.StartInfo.RedirectStandardOutput = true;

        var stdout = new StringBuilder ();
        var stderr = new StringBuilder ();
        applyShader.OutputDataReceived += (s, e) => { if (e.Data.Trim ().Length > 0) stdout.Append("\t").Append (e.Data).Append ("\n"); };
        applyShader.ErrorDataReceived += (s, e) => { if (e.Data.Trim ().Length > 0) stderr.Append("\t").Append (e.Data).Append ("\n"); };

        applyShader.Start ();
        applyShader.BeginOutputReadLine ();
        applyShader.BeginErrorReadLine ();

        applyShader.WaitForExit ();
        var exitCode = applyShader.ExitCode;
        applyShader.Dispose ();
        if (exitCode != 0)
            errorList.Add (String.Format ("Test {0} failed with:\n{1}{2}", test_name, stdout, stderr));
        return exitCode == 0;
    }
开发者ID:kumpera,项目名称:PixelMagic,代码行数:25,代码来源:TestRunner.cs

示例2: OnPostprocessAllAssets

    static void OnPostprocessAllAssets (string[] ia, string[] da, string[] ma, string[] mfap) {
        // skip if importing dll as already built
        if (Array.IndexOf(ia, "Assets/dll/scripts.dll") > -1) return;

        // setup the process
        var p = new Process();
        p.StartInfo.FileName = "/usr/bin/make";
        p.StartInfo.Arguments = "-C " + System.IO.Directory.GetCurrentDirectory() + "/Assets/Editor/";
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.RedirectStandardOutput = true;
        p.StartInfo.RedirectStandardError = true;

        // assign events
        p.OutputDataReceived +=
            new DataReceivedEventHandler((o, e) => {
                if (e.Data != null) {
                    UnityEngine.Debug.Log(e.Data);
                }
            });
        p.ErrorDataReceived +=
            new DataReceivedEventHandler((o, e) => {
                if (e.Data != null) {
                    UnityEngine.Debug.LogError(e.Data);
                }
            });

        // start to process and output/error reading
        p.Start();
        p.BeginOutputReadLine();
        p.BeginErrorReadLine();
    }
开发者ID:shockham,项目名称:unity_fsharp_skeleton,代码行数:31,代码来源:BuildFSharp.cs

示例3: Test1

	static void Test1 (Process p)
	{
		ManualResetEvent mre_exit = new ManualResetEvent (false);
		ManualResetEvent mre_output = new ManualResetEvent (false);
		ManualResetEvent mre_error = new ManualResetEvent (false);

		p.EnableRaisingEvents = true;
		p.Exited += (s, a) => mre_exit.Set ();

		p.Start ();

		p.OutputDataReceived += (s, a) => {
			if (a.Data == null) {
				mre_output.Set ();
				return;
			}
		};

		p.ErrorDataReceived += (s, a) => {
			if (a.Data == null) {
				mre_error.Set ();
				return;
			}
		};

		p.BeginOutputReadLine ();
		p.BeginErrorReadLine ();

		if (!mre_exit.WaitOne (10000))
			Environment.Exit (1);
		if (!mre_output.WaitOne (1000))
			Environment.Exit (2);
		if (!mre_error.WaitOne (1000))
			Environment.Exit (3);
	}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:35,代码来源:process-stress-3.cs

示例4: LaunchAdapter

    private static Process LaunchAdapter(int adaptee, int adapted)
    {
        var temp = Path.GetTempFileName() + ".ensimea.exe";
        File.Copy(@"%SCRIPTS_HOME%\ensimea.exe".Expand(), temp);

        var psi = new ProcessStartInfo();
        psi.FileName = temp;
        psi.Arguments = String.Format("{0} {1}", adaptee, adapted);
        psi.UseShellExecute = false;
        psi.RedirectStandardOutput = true;
        psi.RedirectStandardError = true;

        var p = new Process();
        p.StartInfo = psi;
        p.OutputDataReceived += (sender, args) => { if (args.Data != null) Console.WriteLine(args.Data); };
        p.ErrorDataReceived += (sender, args) => { if (args.Data != null) Console.WriteLine(args.Data); };

        if (p.Start()) {
          p.BeginOutputReadLine();
          p.BeginErrorReadLine();
          return p;
        } else {
          return null;
        }
    }
开发者ID:xeno-by,项目名称:dotwindows,代码行数:25,代码来源:ensime.cs

示例5: getPathDialog

    /// <summary>
    /// getPathDialogメソッド (コルーチン実行)
    /// </summary>
    /// <param name="script">スクリプト(AppleScript)</param>
    /// <param name="argv">スクリプト引数</param>
    /// <param name="onClosed">終了通知</param>
    public IEnumerator getPathDialog(string script, System.Action<string, string> onClosed)
    {
        Process fileDialog = new Process ();				// fileDialogプロセス
        StringBuilder path = new StringBuilder ();			// 取得したファイルパス
        StringBuilder errorMessage = new StringBuilder ();	// エラーメッセージ
        // プロセスの初期設定
        fileDialog.StartInfo = new ProcessStartInfo ()
        {
            FileName = "osascript",			// 実行app (osascript : Applescriptを実行するmac標準app)
            Arguments = script,				// 実行appへの引数 (スクリプト自体)
            CreateNoWindow = true,			// terminalは非表示にする
            UseShellExecute = false,		// シェル機能を使用しない
            RedirectStandardOutput = true,	// スクリプトからの戻り値を受信する
            RedirectStandardError = true,	// スクリプトのエラーメッセージを受信する
        };
        // スクリプト戻り値イベント設定
        fileDialog.OutputDataReceived += (object sender, DataReceivedEventArgs e) =>  {
            // 戻り値がないときも呼び出される場合があるので,戻り値があるか判定
            if(string.IsNullOrEmpty(e.Data) == false) {
                // 戻り値はURLエンコードされているのでデコード
                path.Append(WWW.UnEscapeURL(e.Data));
                UnityEngine.Debug.Log(WWW.UnEscapeURL(e.Data));
            }
        };
        // スクリプトエラーメッセージ受信イベント設定
        fileDialog.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => {
            // エラーがないときも呼び出される場合があるので,エラーメッセージがあるか判定
            if(string.IsNullOrEmpty(e.Data) == false) {
                errorMessage.Append(e.Data);
                UnityEngine.Debug.Log(e.Data);
            }
        };
        // プロセススタート.
        fileDialog.Start ();
        fileDialog.BeginOutputReadLine ();
        fileDialog.BeginErrorReadLine ();

        // 1フレーム待機し,その後applescriptのACTIVATE命令を実行
        yield return null;
        Process.Start (new ProcessStartInfo () { FileName = "osascript", Arguments = FORCE_ACTIVATE });
        // fileDialogが終了するまで待機
        while (fileDialog.HasExited == false) {
            yield return null;
        }
        // プロセスを終了・破棄
        fileDialog.Close ();
        fileDialog.Dispose ();
        // 終了通知
        onClosed.Invoke (path.ToString (), errorMessage.ToString());
    }
开发者ID:gtacenterprise,项目名称:plen__motion_editor_for_Unity,代码行数:56,代码来源:FileChooser.cs

示例6: RunProcess

    public Task<int> RunProcess(string fileName, string arguments, Action<string> outputAction, Action<string> errorAction)
    {
        LogTo.Information(string.Format("Executing process: {0} {1}", fileName, arguments));
        var tcs = new TaskCompletionSource<int>();

        var process = new Process
        {
            StartInfo =
            {
                FileName = fileName,
                Arguments = arguments,
                CreateNoWindow = true,
                UseShellExecute = false,
                WindowStyle = ProcessWindowStyle.Hidden,
                RedirectStandardError = true,
                RedirectStandardOutput = true,
            },
            EnableRaisingEvents = true,
        };
        process.OutputDataReceived += (sender, args) =>
        {
            if (args.Data != null)
            {
                LogTo.Information(args.Data);
                outputAction(args.Data);
            }
        };
        process.ErrorDataReceived += (sender, args) =>
        {
            if (args.Data != null)
            {
                LogTo.Error(args.Data);
                errorAction(args.Data);
            }
        };
        process.Exited += (sender, args) =>
        {
            tcs.SetResult(process.ExitCode);
            //TODO: result
            process.Dispose();
        };

        process.Start();
        process.BeginErrorReadLine();
        process.BeginOutputReadLine();

        return tcs.Task;
    }
开发者ID:nagyist,项目名称:PlatformInstaller,代码行数:48,代码来源:ProcessRunner.cs

示例7: ReadAttachInfo

    // 启动代理读取Cell项
    public static string ReadAttachInfo(string code)
    {
        string stdOutput = "";
        string errOutput = "";

        Process agentProcess = new Process();
        agentProcess.StartInfo.FileName = "ExcelAccessAgent";       // ExcelAccessAgent.exe在同一目录下
        agentProcess.StartInfo.Arguments = Path.Combine(ToolManager.Instance.virtualWorkDir, ToolManager.Instance.HeroExcel) + " read " + code;
        agentProcess.StartInfo.CreateNoWindow = true;
        agentProcess.StartInfo.UseShellExecute = false;
        agentProcess.StartInfo.RedirectStandardOutput = true;
        agentProcess.StartInfo.RedirectStandardError = true;
        agentProcess.EnableRaisingEvents = false;

        agentProcess.OutputDataReceived += (object sender, DataReceivedEventArgs e) =>
        {
            stdOutput += e.Data;
        };

        agentProcess.ErrorDataReceived += (object sender, DataReceivedEventArgs e) =>
        {
            errOutput += e.Data;
        };

        agentProcess.Start();
        agentProcess.BeginOutputReadLine();
        agentProcess.BeginErrorReadLine();
        agentProcess.WaitForExit();

        if (agentProcess.ExitCode != 0)
        {
            // 用户错误指示
            if (errOutput.Contains("找不到Code为"))
            {
                ToolManager.Instance.InfoStr = "Excel中没有采用此Spine的行!";
            }
            else if(errOutput.Contains("由另一进程使用"))
            {
                ToolManager.Instance.InfoStr = "Excel被别的程序打开,请先关闭";
            }

            Debug.LogError("ExcelAccessAgent遇到错误: " + errOutput);
            // System.Windows.Forms.MessageBox.Show(errOutput, "错误", System.Windows.Forms.MessageBoxButtons.OK);
            return "";
        }
        return stdOutput;
    }
开发者ID:Henry-T,项目名称:UnityPG,代码行数:48,代码来源:ExcelAccessAgent.cs

示例8: WriteAttachInfo

    // 启动代理写入数据项
    public static bool WriteAttachInfo(string code, string value)
    {
        string stdOutput = "";
        string errOutput = "";

        Process agentProcess = new Process();
        agentProcess.StartInfo.FileName = "ExcelAccessAgent";
        agentProcess.StartInfo.Arguments =  Path.Combine(ToolManager.Instance.virtualWorkDir, ToolManager.Instance.HeroExcel) + " write " + code + " " + value;
        agentProcess.StartInfo.CreateNoWindow = true;
        agentProcess.StartInfo.UseShellExecute = false;
        agentProcess.StartInfo.RedirectStandardOutput = true;
        agentProcess.StartInfo.RedirectStandardError = true;
        agentProcess.EnableRaisingEvents = false;

        agentProcess.OutputDataReceived += (object sender, DataReceivedEventArgs e) =>
        {
            stdOutput += e.Data;
        };

        agentProcess.ErrorDataReceived += (object sender, DataReceivedEventArgs e) =>
        {
            errOutput += e.Data;
        };

        agentProcess.Start();
        agentProcess.BeginOutputReadLine();
        agentProcess.BeginErrorReadLine();
        agentProcess.WaitForExit();

        if (agentProcess.ExitCode != 0)
        {
            // 用户错误指示
            if (errOutput.Contains("System.IO.IOException"))
            {
                ToolManager.Instance.InfoStr = "Excel被别的程序打开,请先关闭";
            }

            Debug.LogError("ExcelAccessAgent遇到错误: " + errOutput);

            return false;
        }
        return true;
    }
开发者ID:Henry-T,项目名称:UnityPG,代码行数:44,代码来源:ExcelAccessAgent.cs

示例9: Main

    public static void Main()
    {
        Process exe = new Process ();
        exe.StartInfo.EnvironmentVariables.Clear ();
        exe.StartInfo.UseShellExecute = false;
        exe.StartInfo.RedirectStandardOutput = true;
        exe.StartInfo.RedirectStandardError = true;
        #if FAST
        exe.StartInfo.EnvironmentVariables["LANG"] = "C.UTF-8";
        #endif
        exe.StartInfo.FileName = "./perf";
        exe.StartInfo.Arguments = "stat -d ./monobuild/bin/mono-sgen -O=-aot scimark.exe MM";

        exe.OutputDataReceived += (sender, args) => Console.WriteLine ("{0}", args.Data);
        exe.ErrorDataReceived += (sender, args) => Console.WriteLine ("{0}", args.Data);
        exe.Start ();
        exe.BeginOutputReadLine ();
        exe.BeginErrorReadLine ();

        exe.WaitForExit ();
        if (exe.ExitCode != 0) {
            Console.Out.WriteLine ("forking failed a bit");
        }
    }
开发者ID:lewurm,项目名称:scimark-mm-regression,代码行数:24,代码来源:hax.cs

示例10: TryLLDB

	static void TryLLDB (int pid, ProcessData data)
	{
		string filename = Path.GetTempFileName ();

		using (StreamWriter sw = new StreamWriter (new FileStream (filename, FileMode.Open, FileAccess.Write)))
		{
			sw.WriteLine ("process attach --pid " + pid);
			sw.WriteLine ("thread list");
			sw.WriteLine ("thread backtrace all");
			sw.WriteLine ("detach");
			sw.WriteLine ("quit");
			sw.Flush ();

			ProcessStartInfo psi = new ProcessStartInfo {
				FileName = "lldb",
				Arguments = "--batch --source \"" + filename + "\" --no-lldbinit",
				UseShellExecute = false,
				RedirectStandardError = true,
				RedirectStandardOutput = true,
			};

			using (Process process = new Process { StartInfo = psi })
			{
				process.OutputDataReceived += delegate (object sender, DataReceivedEventArgs e) {
					lock (data.stdoutLock) {
						if (e.Data != null)
							data.stdout.AppendLine (e.Data);
					}
				};

				process.ErrorDataReceived += delegate (object sender, DataReceivedEventArgs e) {
					lock (data.stderrLock) {
						if (e.Data != null)
							data.stderr.AppendLine (e.Data);
					}
				};

				process.Start ();
				process.BeginOutputReadLine ();
				process.BeginErrorReadLine ();
				if (!process.WaitForExit (60 * 1000))
					process.Kill ();
			}
		}
	}
开发者ID:mono,项目名称:mono,代码行数:45,代码来源:test-runner.cs

示例11: StartProcess

    private void StartProcess()
    {
        try {
            if (process != null && !process.HasExited) {
                process.WaitForExit ();
            }

            process	= new Process ();
            process.StartInfo.FileName = sAdb;
            process.StartInfo.Arguments = sArgs;

            process.StartInfo.UseShellExecute	= false;
            process.StartInfo.CreateNoWindow	= false;

            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError = true;
            process.EnableRaisingEvents = true;

            process.OutputDataReceived	+= new DataReceivedEventHandler (OutputHandler);
            process.ErrorDataReceived	+= new DataReceivedEventHandler (ErrorOutputHanlder);
            process.Exited	+= new System.EventHandler (Process_Exit);

            if (process.Start ()) {
                process.BeginOutputReadLine();
                process.BeginErrorReadLine();
            }
        } catch (System.Exception e) {
            UnityEngine.Debug.LogError (e);
        }
    }
开发者ID:2ty,项目名称:race3d,代码行数:30,代码来源:ADBWindow.cs

示例12: Main


//.........这里部分代码省略.........
					data.test = test;

					string log_prefix = "";
					if (opt_set != null)
						log_prefix = "." + opt_set.Replace ("-", "no").Replace (",", "_");

					data.stdoutFile = test + log_prefix + ".stdout";
					data.stdout = new StreamWriter (new FileStream (data.stdoutFile, FileMode.Create));

					data.stderrFile = test + log_prefix + ".stderr";
					data.stderr = new StreamWriter (new FileStream (data.stderrFile, FileMode.Create));

					p.OutputDataReceived += delegate (object sender, DataReceivedEventArgs e) {
						if (e.Data != null) {
							data.stdout.WriteLine (e.Data);
						} else {
							data.stdout.Flush ();
							data.stdout.Close ();
						}
					};

					p.ErrorDataReceived += delegate (object sender, DataReceivedEventArgs e) {
						if (e.Data != null) {
							data.stderr.WriteLine (e.Data);
						} else {
							data.stderr.Flush ();
							data.stderr.Close ();
						}
					};

					p.Start ();

					p.BeginOutputReadLine ();
					p.BeginErrorReadLine ();

					if (!p.WaitForExit (timeout * 1000)) {
						lock (monitor) {
							timedout.Add (data);
						}

						if (concurrency == 1)
							Console.WriteLine ("timed out.");
						else
							Console.Write (".");

						p.Kill ();
					} else if (p.ExitCode != expectedExitCode) {
						lock (monitor) {
							failed.Add (data);
						}

						if (concurrency == 1)
							Console.WriteLine ("failed.");
						else
							Console.Write (".");
					} else {
						lock (monitor) {
							passed.Add (data);
						}

						if (concurrency == 1)
							Console.WriteLine ("passed.");
						else
							Console.Write (".");
					}
开发者ID:sparraguerra,项目名称:mono,代码行数:66,代码来源:test-runner.cs

示例13: Run

            public bool Run()
            {
                try
                {
                   bool saveDef = opts.saveDefaultOutput,
                    saveErr = opts.saveErrorOutput;

                   ResetOutput();

                   Process objProcess = new Process();

                   if (!opts.wait)
                   {
                 saveDef = false;
                 saveErr = false;
                   }

                   if (opts.checkSuccessMethod == Software.CheckSuccessMethod.DEFAULTOUTPUT)
                  saveDef = true;

                   if (opts.checkSuccessMethod == Software.CheckSuccessMethod.ERROROUTPUT)
                  saveErr = true;

                   if (string.IsNullOrEmpty(opts.workingDirectory.Path))
                  opts.workingDirectory.Path = opts.exeFile.Path;

                   objProcess.StartInfo.RedirectStandardOutput = saveDef;
                   objProcess.StartInfo.RedirectStandardError = saveErr;
                   objProcess.StartInfo.FileName = opts.exeFile.FullPath;
                   objProcess.StartInfo.Arguments = opts.arguments;
                   objProcess.StartInfo.UseShellExecute = opts.useShell;
                   objProcess.StartInfo.WorkingDirectory = opts.workingDirectory.Path;

                   if (saveDef)
                  objProcess.OutputDataReceived += new DataReceivedEventHandler(NewOutputData);

                   if (saveErr)
                  objProcess.ErrorDataReceived += new DataReceivedEventHandler(NewErrorData);

                   objProcess.Start();

                   if (saveDef) objProcess.BeginOutputReadLine();
                   if (saveErr) objProcess.BeginErrorReadLine();

                   if (opts.wait)
                  objProcess.WaitForExit();

                   int exitCode = objProcess.ExitCode;

                   bool successfull = false;
                   switch (opts.checkSuccessMethod)
                   {
                  case Software.CheckSuccessMethod.EXITCODE:
                     if (exitCode == successExitCode)
                        successfull = true;
                     break;
                  case Software.CheckSuccessMethod.DEFAULTOUTPUT:
                     if (saveDef)
                        successfull = FindText(ref DefaultOutput);
                     break;
                  case Software.CheckSuccessMethod.ERROROUTPUT:
                     if (saveErr)
                        successfull = FindText(ref ErrorOutput);
                     break;
                  default:
                     successfull = true;
                     break;
                   }

                   exception = null;
                   return successfull;
                }
                catch(Exception ex)
                {
                   exception = ex;
                   return false;
                }
            }
开发者ID:JauchOnGitHub,项目名称:csharptoolbox,代码行数:78,代码来源:ExternalApp.cs

示例14: Main


//.........这里部分代码省略.........
					Process p = new Process ();
					p.StartInfo = info;

					ProcessData data = new ProcessData ();
					data.test = test;

					string log_prefix = "";
					if (opt_set != null)
						log_prefix = "." + opt_set.Replace ("-", "no").Replace (",", "_");

					data.stdoutName = test + log_prefix + ".stdout";
					data.stdout = new StringBuilder ();

					data.stderrName = test + log_prefix + ".stderr";
					data.stderr = new StringBuilder ();

					p.OutputDataReceived += delegate (object sender, DataReceivedEventArgs e) {
						if (e.Data != null) {
							data.stdout.AppendLine (e.Data);
						}
					};

					p.ErrorDataReceived += delegate (object sender, DataReceivedEventArgs e) {
						if (e.Data != null) {
							data.stderr.AppendLine (e.Data);
						}
					};

					var start = DateTime.UtcNow;

					p.Start ();

					p.BeginOutputReadLine ();
					p.BeginErrorReadLine ();

					if (!p.WaitForExit (timeout * 1000)) {
						lock (monitor) {
							timedout.Add (data);
						}

#if !MOBILE_STATIC
						// Force the process to print a thread dump
						try {
							Syscall.kill (p.Id, Signum.SIGQUIT);
							Thread.Sleep (1000);
						} catch {
						}
#endif

						if (verbose) {
							output.Write ($"timed out ({timeout}s)");
						}

						try {
							p.Kill ();
						} catch {
						}
					} else if (p.ExitCode != expectedExitCode) {
						var end = DateTime.UtcNow;

						lock (monitor) {
							failed.Add (data);
						}

						if (verbose)
							output.Write ("failed, time: {0}, exit code: {1}", (end - start).ToString (TEST_TIME_FORMAT), p.ExitCode);
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:67,代码来源:test-runner.cs

示例15: Main


//.........这里部分代码省略.........
							procArgs.Append (" --devname=").Append (Quote (device_name));
						procArgs.Append (" -argument=-connection-mode -argument=none");
						procArgs.Append (" -argument=-app-arg:-autostart");
						procArgs.Append (" -argument=-app-arg:-autoexit");
						procArgs.Append (" -argument=-app-arg:-enablenetwork");
						procArgs.AppendFormat (" -argument=-app-arg:-hostport:{0}", listener.Port);
						procArgs.Append (" -argument=-app-arg:-hostname:");
						foreach (var arg in mtouch_arguments)
							procArgs.Append (" ").Append (arg);
						var ipAddresses = System.Net.Dns.GetHostEntry (System.Net.Dns.GetHostName ()).AddressList;
						for (int i = 0; i < ipAddresses.Length; i++) {
							if (i > 0)
								procArgs.Append (',');
							procArgs.Append (ipAddresses [i].ToString ());
						}
						proc.StartInfo.FileName = mtouch;
						proc.StartInfo.Arguments = procArgs.ToString ();
						proc.StartInfo.UseShellExecute = false;
						proc.StartInfo.RedirectStandardOutput = true;
						proc.StartInfo.RedirectStandardError = true;
						proc.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) {
							lock (output) {
								output.Append ("[mtouch stderr] ");
								output.AppendLine (e.Data);
							}
						};
						proc.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) {
							lock (output) {
								output.Append ("[mtouch stdout] ");
								output.AppendLine (e.Data);
							}
						};
						proc.Start ();
						proc.BeginErrorReadLine ();
						proc.BeginOutputReadLine ();
						proc.WaitForExit ();
						if (proc.ExitCode != 0)
							listener.Cancel ();
						Console.WriteLine (output.ToString ());
					}
				});
			}

			var lastErrorDataReceived = new AutoResetEvent (true);
			var lastOutDataReceived = new AutoResetEvent (true);
			if (launchsim != null) {
				lastErrorDataReceived.Reset ();
				lastOutDataReceived.Reset ();

				ThreadPool.QueueUserWorkItem ((v) => {
					{
						proc = new Process ();
						int pid = 0;
						StringBuilder output = new StringBuilder ();
						StringBuilder procArgs = new StringBuilder ();
						string sdk_root = Environment.GetEnvironmentVariable ("XCODE_DEVELOPER_ROOT");
						if (!String.IsNullOrEmpty (sdk_root))
							procArgs.Append ("--sdkroot ").Append (sdk_root);
						procArgs.Append (" --launchsim ");
						procArgs.Append (Quote (launchsim));
						if (!string.IsNullOrEmpty (device_type))
							procArgs.Append (" --device ").Append (device_type);
						procArgs.Append (" -argument=-connection-mode -argument=none");
						procArgs.Append (" -argument=-app-arg:-autostart");
						procArgs.Append (" -argument=-app-arg:-autoexit");
						procArgs.Append (" -argument=-app-arg:-enablenetwork");
开发者ID:couchbasedeps,项目名称:Touch.Unit,代码行数:67,代码来源:Main.cs


注:本文中的Process.BeginErrorReadLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。