public async Task CorrectlyConnectOutputPipes()
        {
            {
                var si = new ProcessPipelineStartInfo()
                {
                    StdOutputRedirection = OutputRedirection.OutputPipe,
                    StdErrorRedirection  = OutputRedirection.ErrorPipe,
                };
                si.Add(TestUtil.TestChildPath, "EchoOutAndError");
                si.Add(TestUtil.TestChildPath, "EchoBack");
                si.Add(TestUtil.TestChildPath, "EchoBack");

                using (var sut = ProcessPipeline.Start(si))
                {
                    await ChildProcessAssert.CorrectlyConnectsPipesAsync(sut, "TestChild.Out", "TestChild.Error");
                }
            }

            {
                // invert stdout and stderr
                var si = new ProcessPipelineStartInfo()
                {
                    StdOutputRedirection = OutputRedirection.ErrorPipe,
                    StdErrorRedirection  = OutputRedirection.OutputPipe,
                };
                si.Add(TestUtil.TestChildPath, "EchoOutAndError");
                si.Add(TestUtil.TestChildPath, "EchoBack");
                si.Add(TestUtil.TestChildPath, "EchoBack");

                using (var sut = ProcessPipeline.Start(si))
                {
                    await ChildProcessAssert.CorrectlyConnectsPipesAsync(sut, "TestChild.Error", "TestChild.Out");
                }
            }
        }
Example #2
0
        public async Task CorrectlyConnectOutputPipes()
        {
            {
                var si = new ChildProcessStartInfo(TestUtil.DotnetCommand, TestUtil.TestChildPath, "EchoOutAndError")
                {
                    StdOutputRedirection = OutputRedirection.OutputPipe,
                    StdErrorRedirection  = OutputRedirection.ErrorPipe,
                };

                using (var sut = ChildProcess.Start(si))
                {
                    await ChildProcessAssert.CorrectlyConnectsPipesAsync(sut, "TestChild.Out", "TestChild.Error");
                }
            }

            {
                // invert stdout and stderr
                var si = new ChildProcessStartInfo(TestUtil.DotnetCommand, TestUtil.TestChildPath, "EchoOutAndError")
                {
                    StdOutputRedirection = OutputRedirection.ErrorPipe,
                    StdErrorRedirection  = OutputRedirection.OutputPipe,
                };

                using (var sut = ChildProcess.Start(si))
                {
                    await ChildProcessAssert.CorrectlyConnectsPipesAsync(sut, "TestChild.Error", "TestChild.Out");
                }
            }
        }