Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Detaching from process



  • i have a function with QProcess (qt 5.7.1 linux)

    void function()
    {
    QProcess process;
    process.start("name program");
    }

    when i do the start of QProcess (only in debug mode)
    i have this message in Application output "Detaching from process".
    This for any qprocess launched from any Qthread (also the main thread), i have a way to silence this message? is very annoying



  • @Massimiliano75
    It's not "annoying", it's indirectly warning you that your code is not good....

    Your QProcess process variable means that it goes out of scope once you exit the method. And since you have only start()ed the process but not waited for it finish, this is bad....

    Your QProcess instance should stay in scope until the QProcess::finished signal or similar is received.



  • the function was a quickly written example what happens to me is

    QProcess genericProcessIstance;
    genericProcessIstance.start("script -i eth0"));
    genericProcessIstance.waitForStarted(10000);
    genericProcessIstance.waitForFinished(10000);

    the message is print immediately after the start,it happens to me for all qprocess even if they live in the main thread for the entire life of the program



  • @Massimiliano75
    If the code is written right (I assume you have verified that command finishes correctly within the 10000?), I have never seen such a message from Ubuntu, nor Windows. Having said that, I would never use waitForFinished(), only slots, I don't know if that is relevant to the message issuance.

    Check whether it has anything to do with script command, e.g. try just an ls? Linux script is doing some "funny" stuff. Or, maybe it's your Qt version?



  • @JonB I think it's the version of qt, the previous version was ok, that's why I'm looking for a way to silence it, also because in a while we will go to 5.12



  • @Massimiliano75
    FWIW, I'm on the default Qt 5.12.8 released with Ubuntu 20.04, and I don't see any messages (in debug or release). I don't know whether I ever used 5.7, but I would surely have noticed such a message with whatever versions I used to use.



  • @Massimiliano75 said in Detaching from process:

    Detaching from process

    That message should from GDB



  • @Massimiliano75
    @Bonnie has a good point! Searching woboq for Detaching from process does not show any occurrence in Qt source code, so perhaps you're just talking about a gdb setting/message.



  • @JonB if i check the option

    tools-->debugger-> dgb extended--> debug all children , the message disappears



  • @Massimiliano75
    There you are then :) I note that on mine that option is not checked, never has been, and I've never changed anything. And never received the message. I'd be surprised if you want it checked. Then again, I told you it may be to do with running script and to try, say, ls instead....



  • @JonB
    sorry if i reply now, but my company has closed for a week, launching a script was an example, any qprocess gives me that message also if i start ls, arp-scan or others.

    if i start a program locally i don't have this problem, the problem occurs if i start a program in remote debug, but the versions (local and remote) of gdb and linux are the same


Log in to reply