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

Qmllint as process on Windows do not populate error channel unless called in terminal.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • 6.10
    • 6.9
    • QML: Tooling
    • None
    • Windows

    Description

      On Windows when qmllint is run as a process it does not populate error channel when it discover some errors. It return code -1, and error channel is empty.

      How to reproduce it:

      QProcess process;
      process.setProcessChannelMode(QProcess::SeparateChannels);    
      process.start("qmllint", {"PUT_PATH_TO_QML_FILE_WITH_ERRORS_HERE"});
      if (!process.waitForFinished()) {
        process.kill();
        qDebug() << "QMLLINT didn't finish";
      }
      if (process.exitStatus() != QProcess::NormalExit) {
        qDebug() << "QMLLINT wrong exit";
      }
      
      QString output = process.readAllStandardOutput();
      QString error = process.readAllStandardError();
      
      qDebug() << "QMLLINT qmllint output: " << output;
      qDebug() << "QMLLINT qmllint errors: " << error; 

      Replace "PUT_PATH_TO_QML_FILE_WITH_ERRORS_HERE" with path to this qml file:

      import QtQuick 2.15
      import QtQuick.Window 2.15Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
          Rectangle {
              id: rect
              width: 100
              height: 100
              color: "ble"
              MouseArea {
                  anchors. + fill: pant
                  onClicked: {
                      console.log(rect.x)
                      console.log(ry)
                      console.log(rect.width)
                      console.log(rect.height)        }
          }
      } 

      This file contain errors, but when runed from QtCreator you can see in Application Output, that prints do not have any information about errors from readAllStandardError() and exit code is -1.

      But if you replace this file with one that has only warning:

      import QtQuick 2.15Item {id: root
      width: 100
      height: 100rectangle {
          id: rectangle
          anchors.fill: parent
          color: "blue"    MouseArea {
              anchors.fill: parent
              onClicked: {
                  rectangle.color = Qt.rgba(Math.random(), Math.random(), Math.random(), 1);
              }
          }
      }
      }
        

      You will get exitCode 0, and readAllStandardError() will properly have information about warnings.

      The only exception to that i when we use "–json " (with dash instead of json filename). Then the output has proper information about errors. But in json format which is not always wanted.

       

       

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            kchrusciel Krzysztof Chrusciel
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change