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

BeginOutputReadLine() public method

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

Usage Example

        public void ExecuteSync(string fileName, string arguments, string workingDirectory)
        {
            if (string.IsNullOrWhiteSpace(fileName))
                throw new ArgumentException("fileName");

            var process = new Process {
                StartInfo = {
                    FileName = fileName,
                    Arguments = arguments,
                    WindowStyle = ProcessWindowStyle.Hidden,
                    CreateNoWindow = true,
                    RedirectStandardError = true,
                    RedirectStandardOutput = true,
                    UseShellExecute = false,
                    WorkingDirectory = workingDirectory
                },
            };

            process.OutputDataReceived += Process_OutputDataReceived;
            process.ErrorDataReceived += Process_ErrorDataReceived;
            process.Exited += Process_Exited;

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

                process.WaitForExit();
            } catch (Win32Exception) {
                throw new ExecuteFileNotFoundException(fileName);
            }
        }
All Usage Examples Of System.Diagnostics.Process::BeginOutputReadLine