Unsolved QProcess: Input redirection is not supported
-
Hi Folks,
I have a small batch script on Windows 7:
@Echo OFF:loop
echo %time%
timeout 2 > NUL
goto loopthat 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 -
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.
-
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.batvoid 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?
-
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.
-
@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);