/// <summary> /// Create a new process, executing using the provided start info. /// </summary> /// <param name="startInfo">The information used when starting the new process.</param> /// <returns>An awaitable task containing the result of the process run.</returns> public static async Task <AsyncProcessResult> Run(AsyncProcessStartInfo startInfo) { using (var asyncProcess = new AsyncProcess(startInfo)) { return(await asyncProcess.Run()); } }
/// <summary> /// Class constructor /// </summary> /// <param name="startInfo">The information required for the running of the process.</param> /// <param name="cancellationToken">An optional cancellation token, which if set will about the running process.</param> public AsyncProcess(AsyncProcessStartInfo startInfo, CancellationToken?cancellationToken = null) { m_startInfo = startInfo; m_process = new Process { StartInfo = startInfo.ToProcessStartInfo() }; m_taskCancellationToken = cancellationToken ?? CancellationToken.None; }