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

[Linux] QProcess doesn't recognize errors if UnixProcessFlag::CloseFileDescriptors is active

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.8.3, 6.9.0 RC
    • 6.7
    • Core: I/O
    • None
    • Linux/X11

    Description

      For example when starting a process with a non-existant binary:

      QProcess proc;
        proc.setUnixProcessParameters(QProcess::UnixProcessFlag::CloseFileDescriptors);
      proc.start("foo");
      proc.waitForFinished();
      qDebug() << proc.error() << proc.exitStatus() << proc.exitCode() << proc.errorString();
      

      Without the Flag this prints:
      QProcess::FailedToStart QProcess::NormalExit 255 "Child process set up failed: execve: No such file or directory"

      And with it:
      QProcess::UnknownError QProcess::NormalExit 255 "Unknown error"

       

      As the error is not set, also the errorOccured signal is not sent in the scenario with the flag set.

      I took a look at the sources and it looks like the FailedToStart error and concrete code is communicated via a pipe from the forked process to the original process and the ProcessFlag also closes that pipe. I guess this also affects other scenarios as well but didn't investigate further.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            e.solutions e so
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes