public ProcessExecutionResult RunProcess(BenchEnvironment env, string cwd, string executable, string arguments, ProcessMonitoring monitoring) { if (IsDisposed) { throw new ObjectDisposedException(nameof(ConEmuExecutionHost)); } if (!IsPowerShellExecutionHostRunning) { return backupHost.RunProcess(env, cwd, executable, arguments, monitoring); } if (reloadConfigBeforeNextExecution) { ReloadConfiguration(); } var collectOutput = (monitoring & ProcessMonitoring.Output) == ProcessMonitoring.Output; var response = SendCommand("exec", cwd, executable, arguments); var exitCode = 999999; var transcriptPath = default(string); foreach (var l in response) { ParseExitCode(l, ref exitCode); ParseTranscriptPath(l, ref transcriptPath); } var output = default(string); if (collectOutput && transcriptPath != null && File.Exists(transcriptPath)) { output = File.ReadAllText(transcriptPath, Encoding.Default); File.Delete(transcriptPath); } return new ProcessExecutionResult(exitCode, output); }
public Core(string benchRoot) { Debug.WriteLine("Initializing UI Core for Bench..."); UI = new WinFormsUserInterface(); Config = new BenchConfiguration(benchRoot, true, true, true); Env = new BenchEnvironment(Config); Downloader = BenchTasks.InitializeDownloader(Config); ProcessExecutionHost = new DefaultExecutionHost(); SetupFileWatchers(); }
public void StartProcess(BenchEnvironment env, string cwd, string executable, string arguments, ProcessExitCallback cb, ProcessMonitoring monitoring) { if (IsDisposed) { throw new ObjectDisposedException(nameof(ConEmuExecutionHost)); } if (!IsPowerShellExecutionHostRunning) { backupHost.StartProcess(env, cwd, executable, arguments, cb, monitoring); return; } var collectOutput = (monitoring & ProcessMonitoring.Output) == ProcessMonitoring.Output; var response = SendCommand("exec", cwd, executable, arguments); AsyncManager.StartTask(() => { var exitCode = 999999; var transcriptPath = default(string); foreach (var l in response) { ParseExitCode(l, ref exitCode); ParseTranscriptPath(l, ref transcriptPath); } var output = default(string); if (collectOutput && transcriptPath != null && File.Exists(transcriptPath)) { output = File.ReadAllText(transcriptPath, Encoding.Default); File.Delete(transcriptPath); } var result = new ProcessExecutionResult(exitCode, output); cb(result); }); }
public void Reload(bool configChanged = false) { configReloadNecessary = false; lock (configReloadLockHandle) { Config = Config.Reload(); Env = new BenchEnvironment(Config); if (configChanged) { Downloader.Dispose(); Downloader = BenchTasks.InitializeDownloader(Config); } } OnConfigReloaded(); }