From d405c9e7d94e4a80b303c32c4156d6e1f4bc5bf1 Mon Sep 17 00:00:00 2001 From: Elwador <75888166+Elwador@users.noreply.github.com> Date: Sat, 15 Jun 2024 12:20:54 +0200 Subject: [PATCH] Fix - Didn't mux the video with many languages --- CRD/Utils/Helpers.cs | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/CRD/Utils/Helpers.cs b/CRD/Utils/Helpers.cs index 312c226..cb8f65c 100644 --- a/CRD/Utils/Helpers.cs +++ b/CRD/Utils/Helpers.cs @@ -66,18 +66,30 @@ public class Helpers{ process.StartInfo.RedirectStandardError = true; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; + + process.OutputDataReceived += (sender, e) => + { + if (!string.IsNullOrEmpty(e.Data)) + { + Console.WriteLine(e.Data); + } + }; + process.ErrorDataReceived += (sender, e) => + { + if (!string.IsNullOrEmpty(e.Data)) + { + Console.WriteLine($"ERROR: {e.Data}"); + } + }; + process.Start(); - // To log the output or errors, you might use process.StandardOutput.ReadToEndAsync() - // string output = await process.StandardOutput.ReadToEndAsync(); - string errors = await process.StandardError.ReadToEndAsync(); - + process.BeginOutputReadLine(); + process.BeginErrorReadLine(); + await process.WaitForExitAsync(); - - if (!string.IsNullOrEmpty(errors)) - Console.WriteLine($"Error: {errors}"); - + // Define success condition more appropriately based on the application bool isSuccess = process.ExitCode == 0;