Skip to content

gspawn-win32: improve guess whether process is console process

This is still a work in progress. The problem I am trying to solve here is that, on Windows, the GSpawn API causes terminal windows to appear for every subprocess launched by a console program that is running in an environment where GSpawn thinks it is a GUI process. An example of where this happens: the Vala Language Server, which is launched by Visual Studio Code, spawns meson and pkg-config using the GSpawn API many times. Because VLS is not attached to a real terminal (it is attached to the fake terminal that Code creates), GetConsoleWindow() returns NULL, and therefore GSpawn assumes it is a GUI process, so it uses gspawn-win32-helper.exe instead of gspawn-win32-helper-console.exe to launch subprocesses. Incidentally, doing a move gspawn-win32-helper-console.exe gspawn-win32-helper.exe fixes this problem.

More context: https://github.com/benwaffle/vala-language-server/issues/120#issuecomment-637920300

I haven't tested this patch myself because I've been having trouble building the Vala stack on Windows (particularly gobject-introspection), so I'm interested in your comments.

Edited by Princeton Ferro

Merge request reports