public static CommandLineInvocationResult Run(string command, string arguments)
        {
            var invocation = new CommandLineInvocation()
            {
                Command   = command,
                Arguments = arguments,
            };

            var result = CommandLineInvocationRunner.Run(invocation);

            return(result);
        }
        public static CommandLineInvocationResult Run(CommandLineInvocation invocation)
        {
            var result = new CommandLineInvocationResult();

            void ReceiveOutputData(object sender, DataReceivedEventArgs e)
            {
                invocation.ReceiveOutputData(sender, e);

                result.ReceiveOutputData(sender, e);
            }

            void ReceiveErrorData(object sender, DataReceivedEventArgs e)
            {
                invocation.ReceiveErrorData(sender, e);

                result.ReceiveErrorData(sender, e);
            }

            result.ExitCode = CommandLineInvocationRunner.Run(invocation.Command, invocation.Arguments, ReceiveOutputData, ReceiveErrorData);

            return(result);
        }