System.Diagnostics.Process.BeginErrorReadLine C# (CSharp) Method

BeginErrorReadLine() public method

public BeginErrorReadLine ( ) : void
return void
        public void BeginErrorReadLine() { }
        public void BeginOutputReadLine() { }

Usage Example

Esempio n. 1
1
        public void Pack_Works()
        {
            string pathToNuGet = MakeAbsolute(@".nuget\NuGet.exe");
            string pathToNuSpec = MakeAbsolute(@"src\app\SharpRaven\SharpRaven.nuspec");

            ProcessStartInfo start = new ProcessStartInfo(pathToNuGet)
            {
                Arguments = String.Format(
                        "Pack {0} -Version {1} -Properties Configuration=Release -Properties \"ReleaseNotes=Test\"",
                        pathToNuSpec,
                        typeof(IRavenClient).Assembly.GetName().Version),
                CreateNoWindow = true,
                UseShellExecute = false,
                RedirectStandardError = true,
                RedirectStandardOutput = true,
                WindowStyle = ProcessWindowStyle.Hidden,
            };

            using (var process = new Process())
            {
                process.OutputDataReceived += (s, e) => Console.WriteLine(e.Data);
                process.ErrorDataReceived += (s, e) => Console.WriteLine(e.Data);
                process.StartInfo = start;
                Assert.That(process.Start(), Is.True, "The NuGet process couldn't start.");
                process.BeginOutputReadLine();
                process.BeginErrorReadLine();
                process.WaitForExit(3000);
                Assert.That(process.ExitCode, Is.EqualTo(0), "The NuGet process exited with an unexpected code.");
            }
        }
All Usage Examples Of System.Diagnostics.Process::BeginErrorReadLine