Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProcess: Input redirection is not supported
Forum Updated to NodeBB v4.3 + New Features

QProcess: Input redirection is not supported

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 3.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    moravas
    wrote on last edited by
    #1

    Hi Folks,

    I have a small batch script on Windows 7:
    @Echo OFF

    :loop
    echo %time%
    timeout 2 > NUL
    goto loop

    that is deployed by QProcess, and the output of this process had been redirected into a QIODevice, by this way:
    connect(&_process, &QProcess::readyReadStandardOutput, = {output->write(_process.readAllStandardOutput());});

    The problem is, that in the log file I see a tons of message, like this:
    ERROR: Input redirection is not supported, exiting the process immediately.

    I googled trough the internet, and found the solution to chance the line "timeout 2 > NUL" to "timeout 2" without success.

    Can anybody tell me, what did I wrong?

    Regards,
    Norbert

    K 1 Reply Last reply
    0
    • M moravas

      Hi Folks,

      I have a small batch script on Windows 7:
      @Echo OFF

      :loop
      echo %time%
      timeout 2 > NUL
      goto loop

      that is deployed by QProcess, and the output of this process had been redirected into a QIODevice, by this way:
      connect(&_process, &QProcess::readyReadStandardOutput, = {output->write(_process.readAllStandardOutput());});

      The problem is, that in the log file I see a tons of message, like this:
      ERROR: Input redirection is not supported, exiting the process immediately.

      I googled trough the internet, and found the solution to chance the line "timeout 2 > NUL" to "timeout 2" without success.

      Can anybody tell me, what did I wrong?

      Regards,
      Norbert

      K Offline
      K Offline
      koahnig
      wrote on last edited by koahnig
      #2

      @moravas

      did you try to run the script on command line?

      I have tried to run

       timeout 2 > NUL
      

      on win 10 64 bit this is supported. Unfortunately, I cannot test on win7 for obvious reasons.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #3

        hi
        timeout 2 > NUL
        on win 7 64bit
        in cmd just waits 2 sec and says nothing.
        update:
        if I use your bat file. I get scrolling time :)
        update 2:
        using your bat file as test.bat

        void MainWindow::ProcessText() {
          qDebug()  << p.readAllStandardOutput();
        }
        
        void MainWindow::on_pushButton_released() {
          connect(&p, &QProcess::readyReadStandardOutput, this, &MainWindow::ProcessText);
          p.start("cmd.exe", QStringList() << "/C" << "C:/test.bat");
        }
        

        Does work.

        So can this log error come from something else?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          moravas
          wrote on last edited by moravas
          #4

          Hi,

          yes, it works fine. As I see, you read the output of the batch synchronously. The problem about of my solution is that I connect a method to the "readyReadOutput" signal (or what's the exact name of it) and the problem occurs in this case.

          mrjjM 1 Reply Last reply
          0
          • M moravas

            Hi,

            yes, it works fine. As I see, you read the output of the batch synchronously. The problem about of my solution is that I connect a method to the "readyReadOutput" signal (or what's the exact name of it) and the problem occurs in this case.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @mrjj said:
            Hi, is what you do different from this code?
            readyReadStandardOutput is signal which i connect ProcessText to.

            connect(&p, &QProcess::readyReadStandardOutput, this, &MainWindow::ProcessText);

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved