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

Using QProcess::startDetached() on the console app on Windows causes cmd.exe window to be shown

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: 5.5.1
    • Fix Version/s: 5.8.0
    • Component/s: Core: I/O
    • Labels:
    • Commits:
      bec2fc19fd18768b16925597871c77a61e716abd

      Description

      Many applications of KDE on Windows project with graphical interface have the following issue: when they start a console process (that is, compiled with /SUBSYSTEM:CONSOLE) using QProcess::startDetached(), it doesn't run in the background, but its console windows pops up. After the discussion [1] we nailed the problem down to Qt.

      Windows code for QProcess::start() checks if the caller app have a console window using GetConsoleWindow() system function. If it returns 0, qt arranges system flags accordingly so the console window isn't shown.

      But QProcess::startDetached() does not perform such check and sets CREATE_NEW_CONSOLE flag unconditionally. Applying patch from [2] solves this issue for us, but we'd like to upstream this.

      See also:
      [1] : https://git.reviewboard.kde.org/r/124905/
      [2] : https://git.reviewboard.kde.org/r/127962/diff/1#index_header
      [3] : http://stackoverflow.com/questions/33874243/qprocessstartdetached-but-hide-console-window

        Attachments

          Issue Links

          For Gerrit Dashboard: QTBUG-53833
          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              krf Kevin Funk
              Reporter:
              arrowd Gleb Popov
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes