コード例 #1
0
ファイル: CLIRunner.cs プロジェクト: spascoe/ripple
        private static void runProcess(ProcessStartInfo processStartInfo)
        {
            var runner = new ProcessRunner();

            var start = Console.ForegroundColor;

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();

            ConsoleWriter.PrintHorizontalLine();
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("{0} {1}", processStartInfo.FileName, processStartInfo.Arguments);
            ConsoleWriter.PrintHorizontalLine();

            var returnValue = runner.Run(processStartInfo, new TimeSpan(0, 1, 0), text => { });
            var color = returnValue.ExitCode == 0 ? ConsoleColor.Gray : ConsoleColor.Red;

            Console.ForegroundColor = color;

            Console.WriteLine(returnValue.OutputText);
            Console.WriteLine("ExitCode:  " + returnValue.ExitCode);

            ConsoleWriter.PrintHorizontalLine();

            Console.ForegroundColor = start;
        }
コード例 #2
0
ファイル: Runner.cs プロジェクト: ventaur/ripple
        public bool Run(string command, params object[] parameters)
        {
            var runner = new ProcessRunner();
            var start = Console.ForegroundColor;
            var processStartInfo = Info(command, parameters);

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();

            ConsoleWriter.PrintHorizontalLine();
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("{0} {1}", processStartInfo.FileName, processStartInfo.Arguments);
            ConsoleWriter.PrintHorizontalLine();

            var returnValue = runner.Run(processStartInfo, new TimeSpan(0, 1, 0), text => { });
            var color = returnValue.ExitCode == 0 ? ConsoleColor.Gray : ConsoleColor.Red;

            Console.ForegroundColor = color;

            Console.WriteLine(returnValue.OutputText);
            Console.WriteLine("ExitCode:  " + returnValue.ExitCode);

            ConsoleWriter.PrintHorizontalLine();

            Console.ForegroundColor = start;

            return returnValue.ExitCode == 0;
        }