Beispiel #1
0
        public override bool Execute()
        {
            StatusReporter?.ReportMessage($"Running \"{Args.Command}\" with args \"{Args.Args?.Trim()}\"");
            var process = Process.Start("CMD.exe", "/C " + Args.Command + " " + Args.Args);

            if (process == null)
            {
                return(false);
            }
            process.WaitForExit();
            var exitCode = process.ExitCode;

            if (exitCode != 0)
            {
                StatusReporter?.ReportWarning($"Process exited with exit code {exitCode}.");
            }
            else
            {
                StatusReporter?.ReportMessage($"Process exited with exit code {exitCode}.");
            }
            return(exitCode == 0);
        }