Unsolved How to debug a QProcess output
-
Hello,
I'm working on a personnal project and I'm missing some features (that I'll implement).
Now, I'm looking on how to get the output of a QProcess AT RUNTIME of it. Before, I used startDetached and the app debuged (by it self) what it wants, but I want to capture some values (%) that are printed in terminal (the output) but I searched a long, very long time and I haven't found how to.
Can someone help me to have a solution?
@n1coc4cola -
If you want to read from Process' stdout/stderr don't start as detached.
-
@N1coc4colA said in How to debug a QProcess output:
but I searched a long, very long time and I haven't found how to
What about:
-
yes but it don't work DURING the QProcess RUNTIME, in what I experimented for the moment...
I have try by using connect with readyRead() and readyReadStandardOutput() signals to a readAllStandardOutput() but the signal is not emited during the runtime, I have to use the waitForReadyRead(). Or should I use the readLine() function from QIODevice? readAll()? -
@N1coc4colA Did you read what @Christian-Ehrlicher wrote? Do NOT start the process detached.
-
Yes, but it debugs the first line and I have to do:
process.start(command4);
qDebug() << process.readAllStandardOutput();and else, I need a loop and the loop blocks my program. Else, I connected readRead() and readyReadStandardOutput() but is not emited. Now I switched, my apps uses Github and it have an API. So I use a URL, replace the content by the user's one, get the .zip file (of when you click on download as a .zip) and write it on the disk.
-
@N1coc4colA said in How to debug a QProcess output:
and else, I need a loop and the loop blocks my program
Please read the Signal/Slots documentation and take a look at e.g. the signals of QProcess - there is no need to block anything.
-
@N1coc4colA said in How to debug a QProcess output:
process.start(command4);
qDebug() << process.readAllStandardOutput();This can't work! You need to read when there is actually something to read, so do what @Christian-Ehrlicher suggested...
-