Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved Detaching from process

    General and Desktop
    qprocess
    3
    11
    1191
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Massimiliano75 last edited by

      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

      JonB 1 Reply Last reply Reply Quote 1
      • JonB
        JonB @Massimiliano75 last edited by

        @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.

        M 1 Reply Last reply Reply Quote 2
        • M
          Massimiliano75 @JonB last edited by

          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

          JonB 1 Reply Last reply Reply Quote 0
          • JonB
            JonB @Massimiliano75 last edited by JonB

            @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?

            M 1 Reply Last reply Reply Quote 0
            • M
              Massimiliano75 @JonB last edited by

              @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

              JonB 2 Replies Last reply Reply Quote 0
              • JonB
                JonB @Massimiliano75 last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • B
                  Bonnie last edited by

                  @Massimiliano75 said in Detaching from process:

                  Detaching from process

                  That message should from GDB

                  1 Reply Last reply Reply Quote 2
                  • JonB
                    JonB @Massimiliano75 last edited by

                    @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.

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      Massimiliano75 @JonB last edited by

                      @JonB if i check the option

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

                      JonB 1 Reply Last reply Reply Quote 0
                      • JonB
                        JonB @Massimiliano75 last edited by

                        @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....

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          Massimiliano75 @JonB last edited by Massimiliano75

                          @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

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post