SIL.FieldWorks.UnicodeCharEditor.PUAInstaller.RunProcess C# (CSharp) Méthode

RunProcess() private static méthode

private static RunProcess ( string executable, string args ) : void
executable string
args string
Résultat void
		private static void RunProcess(string executable, string args)
		{
			using (var gennormProcess = new Process())
			{
				gennormProcess.StartInfo = new ProcessStartInfo
					{
						FileName = executable,
						WorkingDirectory = Path.GetDirectoryName(executable), // lets it find its DLL
						Arguments = args,
						WindowStyle = ProcessWindowStyle.Hidden,
						CreateNoWindow = true,
						UseShellExecute = false,
						RedirectStandardOutput = true,
						RedirectStandardError = true
					};

				// For some reason Hidden worked on FW6.0, but not on FW7.0+. NoWindow works!?!

				// Allows us to re-direct the std. output for logging.

				gennormProcess.Start();
				gennormProcess.WaitForExit();
				var ret = gennormProcess.ExitCode;

				// If gen props doesn't run correctly, log what it displays to the standar output
				// and throw and exception
				if (ret != 0)
				{
					if (LogFile.IsLogging())
					{
						LogFile.AddErrorLine("Error running gennorm2:");
						LogFile.AddErrorLine(gennormProcess.StandardOutput.ReadToEnd());
						LogFile.AddErrorLine(gennormProcess.StandardError.ReadToEnd());
					}
					throw new PuaException(ErrorCodes.Gennorm);
				}
			}
		}