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

QProcess::start with "cmd.exe" on windows does nothing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 4.8.4
    • Core: I/O
    • None
    • I'm using Windows 8 with Qt 4.8.4.

    Description

      Don't know if this would be considered a bug- if it's not please consider it an enhancement request.

      I am using QProcess to implement a facility to execute Windows commands like batch files, etc., from within our application. It works quite well, except that I can't use it to execute the command "cmd.exe". No errors, no command prompt window, just nothing. Tracing into the QProcess::start() code, I find this:

      DWORD dwCreationFlags = CREATE_NO_WINDOW;
          dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
          STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
                                       (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
                                       (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
                                       0, 0, 0,
                                       STARTF_USESTDHANDLES,
                                       0, 0, 0,
                                       stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1]
          };
          success = CreateProcess(0, (wchar_t*)args.utf16(),
                                  0, 0, TRUE, dwCreationFlags,
                                  environment.isEmpty() ? 0 : envlist.data(),
                                  workingDirectory.isEmpty() ? 0 : (wchar_t*)QDir::toNativeSeparators(workingDirectory).utf16(),
                                  &startupInfo, pid);
      

      In the debugger I can un-set CREATE_NO_WINDOW and then I can see the DOS window. Shouldn't this at least be settable by a property or something?

      I have seen others who have been puzzled by this behavior: http://stackoverflow.com/questions/10363918/qt-cant-launch-windows-console-with-qprocess http://www.qtforum.org/article/28365/open-a-console-program-with-qprocess-and-show-the-console.html

      Attachments

        Issue Links

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

          Activity

            People

              biochimia João Abecasis
              johnweeks John Weeks
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes