Search code examples
c++linuxboostgtkmmavaloniaui

Boost::process hide console on linux


According to this question : Boost::process hide console on windows

How can I achieve the same but on Linux platform using boost::process ? (prevent console window creation on the newly spawn child process)

My use case is as followed:

I'm trying to call a cross-platform GUI app built from .NET 5.0 AvaloniaUI (C#). And I'm calling that from another GUI app built from gtkmm (c++). It does create black console along with GUI window.

This symptom doesn't occur when I tried calling the same mentioned Avalonia app with another cross-platform Avalonia app. It doesn't create any console, only the GUI window as intended. (Using System.Diagnostics.Process from .NET C#).

So maybe there is some detail behind that make these api behave differently? (boost::process / System.Diagnostics.Process)

Basically I'm looking for the api to do the same thing with System.Diagnostics.Process (C#) on c++


Solution

  • Linux does not create new console, like the others suggested. (unless explicitly define to)

    After more investigation, I found that, it's only a misunderstanding.

    If you use some GUI lib (like GTKmm, in this case), and try to spawn new process, which is a GUI window also, there might be an afterimage-like effect if you don't do it asynchonously

    (If that second GUI window is initialized with black background, like the one created with AvaloniaUI, you may confuse it as another console :p)