[PATCH setup] Also AttachConsole() when not elevating
Jon Turney
jon.turney@dronecode.org.uk
Mon Feb 24 20:44:00 GMT 2020
Arrange to call AttachConsole() when not elevating (e.g. 'setup -B').
This seems to be needed for output to stdout to work via a Windows
pseudo-console ('conpty'), as is used with cygwin >=3.0.0.
Note that setup is a GUI application. I have no idea what it means to
write to stdout without calling AttachConsole(), but that doesn't seem
to work anymore...
---
main.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/main.cc b/main.cc
index 1ed0cfe..b3854a8 100644
--- a/main.cc
+++ b/main.cc
@@ -263,9 +263,6 @@ WinMain (HINSTANCE h,
bool output_only = help_option || VersionOption;
- if (unattended_mode || output_only)
- set_cout ();
-
SetupBaseName = SetupBaseNameOpt;
SetupArch = is_64bit ? "x86_64" : "x86";
SetupIniDir = SetupArch+"/";
@@ -277,6 +274,9 @@ WinMain (HINSTANCE h,
bool elevate = !output_only && OSMajorVersion () >= 6
&& !NoAdminOption && !nt_sec.isRunAsAdmin ();
+ if (unattended_mode || output_only || !elevate)
+ set_cout ();
+
/* Start logging only if we don't elevate. Same for setting default
security settings. */
LogSingleton::SetInstance (*LogFile::createLogFile ());
--
2.21.0
More information about the Cygwin-apps
mailing list