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

QProcess does not execute batch script

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 6.5.3
    • Core: I/O
    • None
    • Windows

    Description

      For some specific conditions QProcess::start/QProcess::startCommand does not execute script

      Steps to reproduce:
      1. Make directory with name with spaces for me it is D:/Test folder/
      2. Copy attached  Test.cmd into cretated folder
      3. Run attached application

      Actual result:
      **

      QProcess::QProcess(0x0)
      QProcess::start( "cmd.exe" , QList("/c", "D:/Test folder/Test.cmd", "--log-path", "D:/Jerald L. Manlapaz") , OpenMode( "ReadOnly|WriteOnly" ) )
      Creating process
         program : [cmd.exe]
         args : cmd.exe  /c "D:/Test folder/Test.cmd" --log-path "D:/Jerald L. Manlapaz"
         pass environment : no
      QProcessPrivate::startupNotification()
      Started
      QProcessPrivate::waitForFinished(30000)
      QProcessPrivate::bytesAvailableInChannel(2) == 98
      QProcessPrivate::tryReadFromChannel(2), read 98 bytes from the process' output
      QProcessPrivate::bytesAvailableInChannel(1) == 0
      QProcessPrivate::tryReadFromChannel(1), 0 bytes available
      QProcessPrivate::bytesAvailableInChannel(2) == 0
      QProcessPrivate::tryReadFromChannel(2), 0 bytes available
      QProcessPrivate::processFinished()
      QProcessPrivate::processFinished(): process is dead
      Finished
      "" 

      Expected result:
      **

      QProcess::QProcess(0x0)
      QProcess::start( "cmd.exe" , QList("/c", "D:/Test folder/Test.cmd", "--log-path", "D:/Jerald L. Manlapaz") , OpenMode( "ReadOnly|WriteOnly" ) )
      Creating process
         program : [cmd.exe]
         args : cmd.exe  /c "D:/Test folder/Test.cmd" --log-path D:/Jerald L. Manlapaz
         pass environment : no
      QProcessPrivate::startupNotification()
      Started
      QProcessPrivate::waitForFinished(30000)
      QProcessPrivate::bytesAvailableInChannel(1) == 9
      QProcessPrivate::tryReadFromChannel(1), read 9 bytes from the process' output
      QProcessPrivate::bytesAvailableInChannel(1) == 38
      QProcessPrivate::tryReadFromChannel(1), read 38 bytes from the process' output
      QProcessPrivate::bytesAvailableInChannel(1) == 7
      QProcessPrivate::tryReadFromChannel(1), read 7 bytes from the process' output
      QProcessPrivate::bytesAvailableInChannel(1) == 0
      QProcessPrivate::tryReadFromChannel(1), 0 bytes available
      QProcessPrivate::bytesAvailableInChannel(2) == 0
      QProcessPrivate::tryReadFromChannel(2), 0 bytes available
      QProcessPrivate::processFinished()
      QProcessPrivate::processFinished(): process is dead
      Finished
      "\"START\"\r\n\"Path to logs = D:/Jerald L. Manlapaz\"\r\n\"END\"\r\n" 

      Note:
      Spaces somehow influence on execution, if remove spaces from path to Test.cmd or spaces from argument value D:/Jerald L. Manlapaz -> D:/JeraldL.Manlapaz it works fine as expected

      Attachments

        1. QProcessTest.zip
          1 kB
        2. Test.cmd
          0.3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            evgenpervenenko Evgen Pervenenko
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes