예제 #1
0
        /// <summary>
        /// Attempts to start the process and returns a task that is completed when the process
        /// exits with an exit code of zero (success).
        /// </summary>
        /// <exception cref="ProcessException">
        /// Thrown if the process cannot be started, or if it does not exit within the timeout
        /// period that was specified when the process was created.
        /// </exception>
        /// <exception cref="ProcessExecutionException">
        /// Thrown if the process exits with a non-zero exit code.
        /// </exception>
        /// <remarks>
        /// Output and error data handlers are guaranteed to be called before this task completes.
        /// </remarks>
        public static async Task RunToExitWithSuccessAsync(this IProcess process)
        {
            int code = await process.RunToExitAsync();

            process.CheckExitCode(code);
        }