# HG changeset patch # User Markus Mützel # Date 1638725211 -3600 # Node ID 88762923aa9a527bef2d8ea113019a4988c9d83f # Parent b8d1edf82ec2d575d09823cef429ab4863ccf352 octave-launch: Attach to console of parent process if applicable. * installer-files/octave-launch.c: If parent process has a console, attach to it. diff -r b8d1edf82ec2 -r 88762923aa9a installer-files/octave-launch.c --- 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. */