Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-126731

QProcess::waitForFinished should return true if process has already finished

    XMLWordPrintable

Details

    Description

      Today, QProcess::waitForFinished returns true only if the process was running at the time of the call, and terminated before the timeout expired.

      This leads to an intrinsic race condition. Once you've started another process you don't know exactly when it terminates. It may be before the waitForFinished() call, or it may be during it, and so the function may return either true or false, and in fact there is absolutely no way to guarantee that the process will return true.

      This seems like an API design error. The function ought to wait for the process to finish, and then return true if the process finished, and false if it did not.

      I realize changing this would break compatibility. Therefore I suggest either changing it in Qt7, or perhaps add a new function with the "correct" semantics, leaving waitForFinished() as-is.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            cnn Qt Core & Network
            jalfd Jesper Dam
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes