public void RunBeforeBounceScript(OptionsAndArguments optionsAndArguments) { if (optionsAndArguments.TargetsAssembly.ExecutableType == BounceDirectoryExecutableType.BeforeBounce) { LogRunningBeforeBounceScript(optionsAndArguments.TargetsAssembly.Executable); var processInfo = new ProcessStartInfo(optionsAndArguments.TargetsAssembly.Executable); processInfo.CreateNoWindow = true; processInfo.RedirectStandardError = true; processInfo.RedirectStandardOutput = true; processInfo.UseShellExecute = false; var p = new Process { StartInfo = processInfo }; var capturer = new RedirectedProcessOutputCapturer(); p.Start(); capturer.CaptureOutputForProcess(p); p.WaitForExit(); if (p.ExitCode != 0) { throw new BeforeBounceScriptException(optionsAndArguments.TargetsAssembly.Executable, capturer.CapturedOutput, p.ExitCode); } optionsAndArguments.TargetsAssembly.Executable = @"Bounce\Targets.dll"; optionsAndArguments.TargetsAssembly.ExecutableType = BounceDirectoryExecutableType.Targets; } }
public void RunBeforeBounceScript(OptionsAndArguments optionsAndArguments) { string script = BeforeBounceScript(optionsAndArguments.BounceDirectory); if (script != null) { LogRunningBeforeBounceScript(script); var processInfo = new ProcessStartInfo(script); processInfo.CreateNoWindow = true; processInfo.RedirectStandardError = true; processInfo.RedirectStandardOutput = true; processInfo.UseShellExecute = false; var p = new Process { StartInfo = processInfo }; var capturer = new RedirectedProcessOutputCapturer(); p.Start(); capturer.CaptureOutputForProcess(p); p.WaitForExit(); if (p.ExitCode != 0) { throw new BeforeBounceScriptException(script, capturer.CapturedOutput, p.ExitCode); } } }