private void installerProcess_Exited(object sender, EventArgs e) { string logName = "EventHandler installerProcess_Exited: "; BootstrapperProcess process = sender as BootstrapperProcess; if (process != null) { process.Exited -= installerProcess_Exited; this.Log(logName + "Removing process '" + process.ExecutionId + "' from running processes dictionary"); this.runningProcesses.TryRemove(process.ExecutionId, out process); int exitCode = process.ExitCode; this.Log(logName + "Exit code is " + exitCode); if (process.ExitedCallback != null) { this.Log(logName + "Executing exited callback"); process.ExitedCallback(exitCode, null); } process.Dispose(); } }
private void guiExtensionProcess_Exited(object sender, EventArgs e) { string logName = "EventHandler process_Exited: "; BootstrapperProcess process = sender as BootstrapperProcess; if (process != null) { process.Exited -= guiExtensionProcess_Exited; this.Log(logName + "Removing process '" + process.ExecutionId + "' from running processes dictionary"); this.runningProcesses.TryRemove(process.ExecutionId, out process); this.Log(logName + "Reading error output"); string errOut = process.StandardError.ReadToEnd(); int exitCode = process.ExitCode; this.Log(logName + "Exit code is " + exitCode); if (exitCode == 2) { this.Log(logName + "GUI extension ended with an exception:" + Environment.NewLine + errOut); throw new ApplicationException("Function call '" + process.ExecutionId + "' to GUI extension failed! GUI extension exception:" + Environment.NewLine + errOut); } else if (exitCode < 0 || exitCode > 2) { this.Log(logName + "GUI extension ended with an unknown exit code (" + exitCode + ")"); throw new ApplicationException("Function call '" + process.ExecutionId + "' to GUI extension failed! GUI extension returned an unknown exit code (" + exitCode + ")!"); } this.Log(logName + "Reading standard output"); string stdOut = process.StandardOutput.ReadToEnd(); if (process.ExitedCallback != null) { this.Log(logName + "Executing exited callback"); process.ExitedCallback(exitCode, stdOut); } process.Dispose(); } }