Ejemplo n.º 1
0
        public static void CallCargoProcess(Func <string, Process> cargoFunc, string taskName, bool printBuildOutput = true, Action <int> exitCodeCallBack = null)
        {
            if (printBuildOutput)
            {
                ProjectUtil.GetBuildWindowPane().Clear();
                ProjectUtil.PrintToBuild(String.Format("------------------------- Cargo {0} -------------------------\n", taskName));
                ProjectUtil.PrintToBuild(taskName.ToUpper(), String.Format("Starting {0} ...", taskName));
            }

            // Get working dir via selected rust project node
            RustProjectNode rustProj = ProjectUtil.GetActiveRustProject();

            // Call the cargo function with current working directory as argument
            Tuple <Process, Exception> process = CommonUtil.TryCatch(() => cargoFunc(rustProj.BaseURI.AbsoluteUrl));

            if (process.Item2 != null)   // Exception
            {
                HandleProcessStartException(process, printBuildOutput);
            }
            else if (process.Item1 != null) // No exception, process is there
            {
                HandleProcess(taskName, rustProj, process, printBuildOutput, exitCodeCallBack);
            }

            if (printBuildOutput)
            {
                ProjectUtil.PrintToBuild("-------------------------------------------------------------\n\n");
            }
        }