Beispiel #1
0
 public SeuratPipelineRunner(string args, string seurat_exec_path, PipelineStatus status_interface)
 {
     this.args             = args;
     this.seurat_exec_path = seurat_exec_path;
     status     = status_interface;
     hasStarted = false;
     exitCode   = -1;
     SetupProcess();
 }
 //toRun should be constructed beforehand
 public SeuratPipelineCollectionRunner(SeuratPipelineRunner[] toRun, PipelineStatus status_interface) : base("", "", status_interface)
 {
     this.toRun = toRun;
     process    = null;
     exitCodes  = new int[toRun.Length];
     for (int i = 0; i < exitCodes.Length; i++)
     {
         exitCodes[i] = -1;
     }
 }
Beispiel #3
0
        public int RunProcess(PipelineStatus status)
        {
            try
            {
                process.Start();

                // do not wait for the child process to exit before
                // reading to the end of its redirected stream.
                // process.WaitForExit();

                // read the output stream first and then wait.
                //output = process.StandardOutput.ReadToEnd();
                //Debug.Log(output);
                process.BeginOutputReadLine();
                process.BeginErrorReadLine();
                process.WaitForExit();
                exitCode = process.ExitCode;
            }
            catch (ThreadAbortException e)
            {
                process.Kill();
                status.SendMessage("Process exited by user");
            }
            catch (System.Exception e)
            {
                status.SendErrorMessage("Run error" + e.ToString()); // or throw new Exception
                exitCode = process.ExitCode;
            }
            finally
            {
                status.SendMessage("Process finished with exit code " + exitCode);
                process.Dispose();
                hasFinished = true;
                process     = null;
            }
            return(exitCode);
        }