Read from QProcess:write()
-
I have an application which runs another applications and sends data into them. Child apps then read that data. Im creating instances of QProcess for each application i want to write to:
QProcess* process = new QProcess(this); process->setProcessChannelMode(QProcess::ForwardedChannels); process->start(...);
Running executables works fine. Now im trying to write info into them, and then read that info inside those executables(executables are another qt projects).
I am writing info to stdin:
process->write(...); //writes into process stdin according to docs
Ok, to read written data inside those processes i use QSocketNotifier:
QSocketNotifier* notifier = new QSocketNotifier(fileno(stdin), QSocketNotifier::Read, this); connect(notifier, &QSocketNotifier::activated, this, [this](){ QMessageBox msgBox; msgBox.setText("I have a data to read!!!"); msgBox.exec(); }); notifier->setEnabled(true);
Unfortunately, QSocketNotifier::activated() never fires...
-
Ok, that is interesting. I wrote this topic using Windows. I ran exactly the same project using linux, and it worked just fine...
I will mark the topic "kinda solved", because i actually develop the thing for linux...
But it seems that windows users will have some trouble finding a workaround. -
See https://bugreports.qt.io/browse/QTBUG-15457 - don't know why it's marked as 'out of scope' though...
-
@Christian-Ehrlicher
Who knows? But the fact that it was raised in year 2010, under Nokia/TrollTech, is interesting ;-)