Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

fix: stderror is correctly output when built for release (#370)

lars-berger21926ff44a37
diff --git a/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs b/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs
index 333f6eb1..1619cb3d 100644
--- a/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs
+++ b/GlazeWM.Infrastructure/WindowsApi/WindowsApiService.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
@@ -469,7 +470,16 @@ namespace GlazeWM.Infrastructure.WindowsApi
public static bool AttachConsoleToParentProcess()
{
const uint AttachParentProcess = 0x0ffffffff;
- return AttachConsole(AttachParentProcess);
+ var result = AttachConsole(AttachParentProcess);
+
+ var streamWriter = new StreamWriter(Console.OpenStandardOutput())
+ {
+ AutoFlush = true
+ };
+ Console.SetOut(streamWriter);
+ Console.SetError(streamWriter);
+
+ return result;
}
}
}