Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Detaching from process
Forum Updated to NodeBB v4.3 + New Features

Detaching from process

Scheduled Pinned Locked Moved Unsolved General and Desktop
qprocess
11 Posts 3 Posters 2.3k Views
  • 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 Offline
    M Offline
    Massimiliano75
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    1
    • M Massimiliano75

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @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
      2
      • JonBJ JonB

        @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 Offline
        M Offline
        Massimiliano75
        wrote on last edited by
        #3

        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

        JonBJ 1 Reply Last reply
        0
        • M Massimiliano75

          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

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @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
          0
          • JonBJ 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 Offline
            M Offline
            Massimiliano75
            wrote on last edited by
            #5

            @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

            JonBJ 2 Replies Last reply
            0
            • M Massimiliano75

              @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

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @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
              0
              • B Offline
                B Offline
                Bonnie
                wrote on last edited by
                #7

                @Massimiliano75 said in Detaching from process:

                Detaching from process

                That message should from GDB

                1 Reply Last reply
                2
                • M Massimiliano75

                  @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

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #8

                  @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
                  0
                  • JonBJ JonB

                    @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 Offline
                    M Offline
                    Massimiliano75
                    wrote on last edited by
                    #9

                    @JonB if i check the option

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

                    JonBJ 1 Reply Last reply
                    0
                    • M Massimiliano75

                      @JonB if i check the option

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

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #10

                      @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
                      0
                      • JonBJ JonB

                        @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 Offline
                        M Offline
                        Massimiliano75
                        wrote on last edited by Massimiliano75
                        #11

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

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved