Minor GetProcStdOut improvement to avoid issues if stderr piping was already in the command line

This commit is contained in:
N00MKRAD
2023-12-22 02:59:40 +01:00
parent 744f09f7fe
commit a5c672c682

View File

@@ -20,7 +20,7 @@ namespace Flowframes.Os
{ {
public static string GetProcStdOut(Process proc, bool includeStdErr = false, ProcessPriorityClass priority = ProcessPriorityClass.BelowNormal) public static string GetProcStdOut(Process proc, bool includeStdErr = false, ProcessPriorityClass priority = ProcessPriorityClass.BelowNormal)
{ {
if (includeStdErr) if (includeStdErr && !proc.StartInfo.Arguments.EndsWith("2>&1"))
proc.StartInfo.Arguments += " 2>&1"; proc.StartInfo.Arguments += " 2>&1";
proc.Start(); proc.Start();