示例#1
0
        public void WaitForExit(bool assertSuccess)
        {
            Exited.Wait();

            if (assertSuccess && _process.ExitCode != 0)
            {
                throw new Exception($"Process exited with code {_process.ExitCode}\nStdErr: {Error}\nStdOut: {Output}");
            }
        }
示例#2
0
        public void WaitForExit(bool assertSuccess, TimeSpan?timeSpan = null)
        {
            if (!timeSpan.HasValue)
            {
                timeSpan = TimeSpan.FromSeconds(480);
            }

            Exited.Wait(timeSpan.Value);

            if (assertSuccess && _process.ExitCode != 0)
            {
                throw new Exception($"Process exited with code {_process.ExitCode}\nStdErr: {Error}\nStdOut: {Output}");
            }
        }
示例#3
0
        public void WaitForExit(bool assertSuccess, TimeSpan?timeSpan = null)
        {
            if (!timeSpan.HasValue)
            {
                timeSpan = TimeSpan.FromSeconds(600);
            }

            var exited = Exited.Wait(timeSpan.Value);

            if (!exited)
            {
                _output.WriteLine($"The process didn't exit within the allotted time ({timeSpan.Value.TotalSeconds} seconds).");
                _process.Dispose();
            }
            else if (assertSuccess && _process.ExitCode != 0)
            {
                throw new Exception($"Process exited with code {_process.ExitCode}\nStdErr: {Error}\nStdOut: {Output}");
            }
        }