Qt Forum

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

    Qt Academy Launch in California!

    Unsolved QProcess dbus service

    General and Desktop
    3
    5
    169
    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.
    • D
      damianatorrpm last edited by damianatorrpm

      I am trying to launch a dbus service file (this service file can not be in PATH! similar to a desktop entry it has an EXEC= line)
      and than start another QProcess that requires the dbus service to be already running.
      (I can not check if the dbus service is registered as the path and interface are unknown at that time).

      My question is how to do that in the best way possible?

      waitForReadyRead(-1) / waitForBytesWritten(-1) return too early and the QProcess fails to start.
      Adding a delay waitForFinished(2000) works but adds 2sec delay.

      EDIT: If it's doable to do so with glib though I haven't found a good solution with it either I can use glib in this Qt project.

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

        @damianatorrpm
        It seems you are saying you do need to wait for a delay, but 2 seconds is uncomfortably long. So can you either make the delay small and keep retrying in loop till it succeeds it "connecting" or whatever you are doing, or is there something in the system you can check which indicates the service is ready to connect to? Qt/QProcess isn't magic, you have to do whatever to guide it to what you want.

        D 1 Reply Last reply Reply Quote 1
        • D
          damianatorrpm @JonB last edited by damianatorrpm

          @JonB I was hoping for some magic like waitForProcessStartedUp() or something similar
          that indicates not that the process has spawned but that its initial state is ready.

          JonB 1 Reply Last reply Reply Quote 0
          • Christian Ehrlicher
            Christian Ehrlicher Lifetime Qt Champion last edited by

            @damianatorrpm said in QProcess dbus service:

            that its initial state is ready.

            And who defines what 'initial state is ready' is? How should this work in a generic way?

            Qt has to stay free or it will die.

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

              @damianatorrpm
              As @Christian-Ehrlicher has said, there is no "initial state is ready". I don't know what "dbus" is, but if you say "service" perhaps, for example, the client you want to spawn is waiting for a socket to be listened on? In which you'd have to do the check for the socket to be active.

              If you can't do something like that, you'll probably have to either wait a "long" time like now (still unreliable), or spawn a number of attempts at short delay apart till one succeeds.

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