I use system() command in Qt. and I want to get output and show it to users.
my command is:
system("echo '" + rootPass.toAscii() + "' | su - root -c 'yum -y install " + packageName.toAscii() + "'");
this command can't run when I use it in QProcess (start or execute function)
but if i can run this command in QProcess i can get output with QProcess::readAllStandardOutput()
function.
also when i used ">" in system command to save output in a file, I receive output when the package completely installed. like bellow:
system("echo '" + rootPass.toAscii() + "' | su - root -c 'yum -y install " + packageName.toAscii() + "' > result.out");
is there any idea about running this command with QProcess, or get output from system() command as soon as write each line.
Best Answer
You can also obtain the output directly from
QProcess
If you don't want to block your event loop, you can always use the signals:
And then call a function to
readAllStandard[Output/Error]