Exemplo n.º 1
0
        public bool StartProcess(string runtimeType, IDictionary <string, string> environment, string workingDirectory)
        {
            if (Process != null)
            {
                UnityEngine.Debug.LogError($"[PROC][main] Failed to start test case process: process is already running");
                return(false);
            }

            UnityEngine.Debug.Log($"[PROC][main] Prepare external test case type:{runtimeType} workingDirectory:{workingDirectory}");

            var testCaseRunner = GetTestCaseRunnerEntrypoint(runtimeType);

            try
            {
                var proc = new TestCaseProcess(testCaseRunner, environment, workingDirectory);

                // Event handlers
                proc.Exited += new EventHandler(ProcessExited);
                proc.Start();

                UnityEngine.Debug.Log($"[PROC][main] Successfully launched app Id={proc.Id}");

                Process = proc;
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogError($"Unable to launch app '{testCaseRunner}': {e.Message}");
            }

            return(Process != null);
        }
Exemplo n.º 2
0
 public void Terminate()
 {
     if (Process != null)
     {
         Process.Terminate(5000);
         Process = null;
     }
     else
     {
         Console.WriteLine("[PROC][main] Process is not running. Nothing to terminate");
     }
 }