public void CanGetExitCode() { var spec = new ProcessSpec { ExecutablePath = "run.bat", Arguments = new[] { "exit 100" } }; var io = new TestProcessIO(); var process = Container.Run(spec, io); var exitCode = process.WaitForExit(); Assert.Equal(100, exitCode); }
public void CanGetProcessErrors() { var spec = new ProcessSpec { ExecutablePath = "run.bat", Arguments = new[] { "echo This is STDERR >&2" } }; var io = new TestProcessIO(); var process = Container.Run(spec, io); process.WaitForExit(); Assert.Contains("This is STDERR", io.Error.ToString()); }
public void CanSetEnvironmentVariables() { var spec = new ProcessSpec { ExecutablePath = "run.bat", Arguments = new[] { "set" }, Environment = new Dictionary <string, string> { { "FOO", "1" }, { "BAR", "two" } } }; var io = new TestProcessIO(); var process = Container.Run(spec, io); process.WaitForExit(); var stdout = io.Output.ToString(); Assert.Contains("FOO=1", stdout); Assert.Contains("BAR=two", stdout); }