changeset 6001:88762923aa9a release

octave-launch: Attach to console of parent process if applicable. * installer-files/octave-launch.c: If parent process has a console, attach to it.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 05 Dec 2021 18:26:51 +0100
parents b8d1edf82ec2
children 38085f903f23 a882556270c8
files installer-files/octave-launch.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/installer-files/octave-launch.c	Thu Dec 02 09:46:19 2021 +0100
+++ b/installer-files/octave-launch.c	Sun Dec 05 18:26:51 2021 +0100
@@ -338,6 +338,12 @@
     StringCchCopyW (argbuffer, ARGBUF_SZ, L"octave.exe ");
     StringCchCatW (path, PATH_SZ, L"\\octave.exe");
 
+    /* If parent process has a console, attach to it.
+       Let the function fail silently, when parent has no console
+       (e.g., when program has been started from link in start menu).
+       No console will be shown in this case. */
+    AttachConsole (ATTACH_PARENT_PROCESS);
+
     if (! (no_gui_libs || no_gui_arg_found))
       {
         /* Unless --no-gui or --no-gui-libs is specified, we will use a GUI window.  */