All right, this post is just to stop somebody else’s suffering in figuring out why writing to stdin in QProcess on Version 3.3.x-8 of Q…/Free doesn’t work on Windows. Well, actually it works but just for the first line you write to stdin. There is a bug in qprocess.cpp at line 730:
void QProcess::writeToStdin( const QString& buf ) { QByteArray tmp = buf.local8Bit(); tmp.resize( tmp.size() - 1 ); // drop the implicit \0 writeToStdin( tmp ); }
should be:
void QProcess::writeToStdin( const QString& buf ) { QByteArray tmp = buf.local8Bit(); tmp.resize( buf.length() ); writeToStdin( tmp ); }
Verision 3.3.7-7 includes the latter method, same as the latest Qt 4.3 sources. So, it’s actually a regression in 3.3.x-8. If you require the latest Qt 3 / Q…/Free for your open source application and need to write to some other processes’ stdin, you can just use a wrapper workaround that uses the latter method and directly uses writeToStdin( const QByteArray& buf ) instead of the QString variant.