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. The missing startDetached overloaded function
Qt 6.11 is out! See what's new in the release blog

The missing startDetached overloaded function

Scheduled Pinned Locked Moved Unsolved General and Desktop
24 Posts 6 Posters 10.3k Views 3 Watching
  • 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.
  • A Aman Jiang

    @kshegunov Okay, I get you, I know the reason now. But, If Qt's goal is make everything easier, why not add one more overloaded startDetached ? If this one:

    bool startDetached(const QString & program);
    

    Could do the right thing cross Qt versions and OS versions, add another one:

    bool startDetached(const QString & program, const QString& workDir);
    

    Is more complete. At least I think so.

    raven-worxR Offline
    raven-worxR Offline
    raven-worx
    Moderators
    wrote on last edited by
    #21

    @Aman-Jiang
    there is already QProcess::setWorkingDirectory() available

    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
    If you have a question please use the forum so others can benefit from the solution in the future

    A 1 Reply Last reply
    0
    • raven-worxR raven-worx

      @Aman-Jiang
      there is already QProcess::setWorkingDirectory() available

      A Offline
      A Offline
      Aman Jiang
      wrote on last edited by
      #22

      @raven-worx A QProcess object will wait for the process, a "detach" member function is missing.

      1 Reply Last reply
      0
      • A Aman Jiang

        @kshegunov Okay, I get you, I know the reason now. But, If Qt's goal is make everything easier, why not add one more overloaded startDetached ? If this one:

        bool startDetached(const QString & program);
        

        Could do the right thing cross Qt versions and OS versions, add another one:

        bool startDetached(const QString & program, const QString& workDir);
        

        Is more complete. At least I think so.

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by kshegunov
        #23

        @Aman-Jiang

        But, If Qt's goal is make everything easier, why not add one more overloaded startDetached ?

        Well, you have to ask Qt devs that, but if I were to hazard a guess - probably simplicity of implementation and compliance with QProcess::start, but I haven't checked the source so I'm just speculating. While the split rules are the same across OSes some (notably Windows) have somewhat stringent requirements for characters in paths (or rather the command line interpreter cmd does), Linux is much more relaxed on this matter.
        My advice is to just wrap a very simple LL(1) parser (it's so simple you can even write it by hand in an hour) and use it to split your command line.

        "detach" member function is missing.

        I'm not sure you can detach from a process freely on all platforms, so I'm assuming it's not missing, it's just impossible to provide in a cross-platform consistent manner.

        Kind regards.

        Read and abide by the Qt Code of Conduct

        A 1 Reply Last reply
        0
        • kshegunovK kshegunov

          @Aman-Jiang

          But, If Qt's goal is make everything easier, why not add one more overloaded startDetached ?

          Well, you have to ask Qt devs that, but if I were to hazard a guess - probably simplicity of implementation and compliance with QProcess::start, but I haven't checked the source so I'm just speculating. While the split rules are the same across OSes some (notably Windows) have somewhat stringent requirements for characters in paths (or rather the command line interpreter cmd does), Linux is much more relaxed on this matter.
          My advice is to just wrap a very simple LL(1) parser (it's so simple you can even write it by hand in an hour) and use it to split your command line.

          "detach" member function is missing.

          I'm not sure you can detach from a process freely on all platforms, so I'm assuming it's not missing, it's just impossible to provide in a cross-platform consistent manner.

          Kind regards.

          A Offline
          A Offline
          Aman Jiang
          wrote on last edited by
          #24

          @kshegunov Okay. Thank you for your advice, I will think about that.

          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