/// <summary>
        /// Can only have stdout stream and stderr handler or
        /// stderr stream and stdout handler because synchronous and
        /// async functions can not be mixed.
        /// </summary>
        /// <param name="pathToExecutable"></param>
        /// <param name="captureStdoutStreamAndUseErrHandler">
        ///     True to have stdout as a stream and handle stderr with a handler.
        ///     False for the other way around
        /// </param>
        /// <param name="outStreamReader"></param>
        /// <param name="handler"></param>
        /// <param name="exitHandler"></param>
        /// <param name="waitForExit"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        public static Process ExecuteProcess(string pathToExecutable,
                                             bool captureStdoutStreamAndUseErrHandler,
                                             out StreamReader outStreamReader,
                                             DataReceivedEventHandler handler,
                                             EventHandler exitHandler,
                                             bool waitForExit = false,
                                             params string[] args)
        {
            StreamReader _;

            return(captureStdoutStreamAndUseErrHandler
                ? ProcessExecutor.ExecuteProcess(
                       pathToExecutable,
                       true,
                       false,
                       out outStreamReader,
                       out _,
                       null,
                       handler,
                       exitHandler,
                       waitForExit,
                       args)
                : ProcessExecutor.ExecuteProcess(
                       pathToExecutable,
                       false,
                       true,
                       out _,
                       out outStreamReader,
                       handler,
                       null,
                       exitHandler,
                       waitForExit,
                       args));
        }
        /// <summary>
        /// Execute process with redirecting only one stream.
        /// </summary>
        /// <param name="pathToExecutable"></param>
        /// <param name="redirectStdOut"></param>
        /// <param name="outStreamReader"> The streamReader for captured stdout or stderr</param>
        /// <param name="exitHandler"></param>
        /// <param name="waitForExit"></param>
        /// <param name="args"></param>
        public static Process ExecuteProcess(string pathToExecutable,
                                             bool redirectStdOut,
                                             out StreamReader outStreamReader,
                                             EventHandler exitHandler,
                                             bool waitForExit = false,
                                             params string[] args)
        {
            StreamReader _;

            return(redirectStdOut
                ? ProcessExecutor.ExecuteProcess(
                       pathToExecutable,
                       true,
                       false,
                       out outStreamReader,
                       out _,
                       null,
                       null,
                       exitHandler,
                       waitForExit,
                       args)
                : ProcessExecutor.ExecuteProcess(
                       pathToExecutable,
                       false,
                       true,
                       out _,
                       out outStreamReader,
                       null,
                       null,
                       exitHandler,
                       waitForExit,
                       args));
        }
        /// <summary>
        /// Execute a process without capturing output
        /// </summary>
        /// <param name="pathToExecutable"></param>
        /// <param name="waitForExit"></param>
        /// <param name="args"></param>
        public static Process ExecuteProcess(string pathToExecutable, EventHandler exitHandler, bool waitForExit = false, params string[] args)
        {
            StreamReader _;

            return
                (ProcessExecutor.ExecuteProcess(
                     pathToExecutable,
                     false,
                     false,
                     out _,
                     out _,
                     null,
                     null,
                     exitHandler,
                     waitForExit,
                     args));
        }
 /// <summary>
 /// Execute process with redirecting output.
 /// </summary>
 /// <param name="pathToExecutable"></param>
 /// <param name="stdout"></param>
 /// <param name="stderr"></param>
 /// <param name="exitHandler"></param>
 /// <param name="waitForExit"></param>
 /// <param name="args"></param>
 public static Process ExecuteProcess(string pathToExecutable,
                                      out StreamReader stdout,
                                      out StreamReader stderr,
                                      EventHandler exitHandler,
                                      bool waitForExit = false,
                                      params string[] args)
 {
     return(ProcessExecutor.ExecuteProcess(
                pathToExecutable,
                true,
                true,
                out stdout,
                out stderr,
                null,
                null,
                exitHandler,
                waitForExit,
                args));
 }
        public static Process ExecuteProcess(string pathToExecutable,
                                             DataReceivedEventHandler stdoutHandler,
                                             DataReceivedEventHandler stderrHandler,
                                             EventHandler exitHandler = null,
                                             bool waitForExit         = false, params string[] args)
        {
            StreamReader _;

            return
                (ProcessExecutor.ExecuteProcess(
                     pathToExecutable,
                     false,
                     false,
                     out _,
                     out _,
                     stdoutHandler,
                     stderrHandler,
                     exitHandler,
                     waitForExit,
                     args));
        }