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. QProcess dbus service
QtWS25 Last Chance

QProcess dbus service

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 467 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.
  • D Offline
    D Offline
    damianatorrpm
    wrote on last edited by damianatorrpm
    #1

    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.

    JonBJ 1 Reply Last reply
    0
    • D 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.

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

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

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

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

        JonBJ 1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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 Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • D 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.

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

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

            • Login

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