commit 167dfbc92c3543bb3833222e67f7b55c9a93a5e3
Author: Eugene Chornyi <[email protected]>
Date:   Mon Mar 8 19:35:18 2021 +0100

    Fix bug 11998
    
    If started from console, the console is the parent process, which can be 
attached. If started not from console, parent process does not exist and the 
block is skipped.
---
 src/main.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index 5c4fb46..94b1ccd 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -21,6 +21,11 @@
 #include <ios>
 #endif
 
+#ifdef WIN32
+#include <Windows.h>
+#endif
+
+
 using namespace std;
 
 
@@ -30,6 +35,13 @@ int main(int argc, char * argv[])
        ios_base::sync_with_stdio(false);
 #endif
 
+#ifdef WIN32
+       if (AttachConsole(ATTACH_PARENT_PROCESS)) {
+               freopen("CONOUT$", "w", stdout);
+               freopen("CONOUT$", "w", stderr);
+       }
+#endif
+
        // To avoid ordering of global object problems with some
        // stdlibs we do the initialization here, but still as
        // early as possible.
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to