From 948b4e72c6cb10eb23a0909bb887586fc34a34f3 Mon Sep 17 00:00:00 2001
From: jeremyd2019 <github@jdrake.com>
Date: Mon, 7 Feb 2022 11:11:09 -0800
Subject: [PATCH] Update launcher.c

---
 launcher.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/launcher.c b/launcher.c
index c965d19..a557b40 100644
--- a/launcher.c
+++ b/launcher.c
@@ -533,7 +533,8 @@ run_child(wchar_t * cmdline)
 
         ok = safe_duplicate_handle(hOut, &si.hStdOutput);
         assert(ok, "stdout duplication failed");
-        CloseHandle(hOut);
+        if (hOut != hErr)
+            CloseHandle(hOut);
         /* We might need stderr late, so don't close it but mark as non-inheritable */
         SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, 0);
 
