Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1680

qbs.Process: capture stdout of actively running process

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 1.15.0
    • API: JavaScript
    • None

    Description

      As far as I understand, in the prepare script of a Rule item, when using the exec() function of qbs.Process, or adding a new command to the script, QBS waits for the process to finish and only then prints the contents of stdout and stderr.

      This works fine for small tasks that finish within seconds, but what about the long running ones? I wanted to integrate a script from another programming language into the build process, which runs for a long time and outputs a lot of information. Because QBS delivers the output only once the job is done, I have no idea what is going on within that script during the build time.

      There is a hacky solution to it though. In the prepare script, instead of Command use JavaScriptCommand. And in the source code have this:

      var process = new Process()
      process.start(executable, arguments)
      while (!process.waitForFinished(1000))
          console.warn(process.readStdOut())

      QProcess should be capable of conveniently reading the stdout of a live process with its signals/slots system, so why not take the full advantage of it? The exec() function could have one more argument, telling which way of stdio capture should be used.

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            clintwestwood Clint Westwood
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes