public static void RunWrapper(string exe, string args) { CancellationTokenSource cts = new CancellationTokenSource(); var progress = new Progress <ProcessProgressDataload>(); progress.ProgressChanged += (s, e) => { Console.WriteLine(string.Format(CultureInfo.CurrentCulture, Strings.ProcessRunnerInferiorOutputPrefix, e.Message)); }; try { Task <Process> t = ProcessAsyncRunner.Run(exe, args, cts.Token, progress); bool processRunning = true; t.ContinueWith((p) => { processRunning = false; }); while (processRunning) { // TODO: Find a less obstrusive way to report (that works on VSCode channels and console stdout) // Console.Write("."); } t.Wait(); } catch (OperationCanceledException ce) { Console.WriteLine(string.Format(CultureInfo.CurrentCulture, Strings.ProcessRunnerInferiorCancelledWithMsg, ce.Message)); } }
public static void RunWrapper(string exe, string args) { CancellationTokenSource cts = new CancellationTokenSource(); var progress = new Progress <ProcessProgressDataload>(); progress.ProgressChanged += (s, e) => { //Console.SetCursorPosition(Console.CursorTop + 2, 0); Console.WriteLine($"From process: {e.Message}"); }; try { Task <Process> t = ProcessAsyncRunner.Run(exe, args, cts.Token, progress); bool processRunning = true; t.ContinueWith((p) => { processRunning = false; }); while (processRunning) { // TODO: Find a less obstrusive way to report (that works on VSCode channels and console stdout) // Console.Write("."); } t.Wait(); } catch (OperationCanceledException ce) { Console.WriteLine($"Operation was cancelled with message: {ce.Message}"); } }