From 743580b4c029e200b1390075a1328ab314973bc2 Mon Sep 17 00:00:00 2001
From: Ron Yorston <rmy@pobox.com>
Date: Sun, 17 Feb 2019 13:59:17 +0000
Subject: ash: updated support for hiding console

Move the code to hide the console to a separate function in
win32/mingw.c.  Use lazy loading to avoid problems on platforms
where the require APIs aren't supported (PR #70).

Enable console hiding in the default 64-bit configuration.
---
 shell/ash.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

(limited to 'shell')

diff --git a/shell/ash.c b/shell/ash.c
index 0040fd3c8..89bd886d3 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -172,8 +172,7 @@
 //config:	  Enable support for the 'noconsole' option, which attempts to
 //config:	  hide the console normally associated with a command line
 //config:	  application.  This may be useful when running a shell script
-//config:	  from a GUI application.  Disable this if your platform doesn't
-//config:	  support the required APIs.
+//config:	  from a GUI application.
 //config:
 //config:endif # ash options
 
@@ -14917,13 +14916,8 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
 #endif
 
 #if ENABLE_ASH_NOCONSOLE
-	if ( noconsole ) {
-		DWORD dummy;
-
-		if ( GetConsoleProcessList(&dummy, 1) == 1 ) {
-			ShowWindow(GetConsoleWindow(), SW_HIDE);
-		}
-	}
+	if (noconsole)
+		hide_console();
 #endif
 
 	if (login_sh) {
-- 
cgit v1.2.3-55-g6feb