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

When calling QProcess::startDetached to start cmd.exe the process starts but the command line window does not appear

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.9.2
    • Core: Other
    • None
    • Windows 10

      Visual Studio 2013 and 2017

      Using Qt 5.9.2 LTS 64 bit prebuilt binaries for VS 2013 and 2017

    Description

      I have a simple Qt project (see attachment) to start a detached process on start up for cmd.exe

      #include <cassert>
      
      
      #include <QProcess>
      
      
      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      
      
      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
      
      
          QProcess p;
      
      
          bool ok = p.startDetached("C:/Windows/system32/cmd.exe");
          assert(ok);
      }
      
      
      MainWindow::~MainWindow()
      {
          delete ui;
      }
      
      
      

      When I build this project using Qt Creator with Qt 5.6.3 it works as expected; the command line window is displayed on application start up.

      When I switch over to build the project using Qt 5.9.1 or 5.9.2, the command line window is not displayed on application start up. However, I can see that the cmd.exe process has indeed started as it is listed in the Task Manager. I can see this behaviour when using either VS 2013 or 2017 compilers.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            chrisr Chris Rucinski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes