예제 #1
0
 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);
 }
예제 #2
0
파일: Core.cs 프로젝트: mastersign/bench
 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();
 }
예제 #3
0
 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);
     });
 }
예제 #4
0
파일: Core.cs 프로젝트: mastersign/bench
 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();
 }