diff options
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r-- | src/corelib/io/qprocess.cpp | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 439f9fce5a..fea5a4c967 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -109,11 +109,13 @@ QT_BEGIN_NAMESPACE \macro QT_NO_PROCESS_COMBINED_ARGUMENT_START \relates QProcess - Disables the QProcess::start() overload taking a single string. + Disables the + \l {QProcess::start(const QString &, OpenMode)}{QProcess::start()} + overload taking a single string. In most cases where it is used, the user intends for the first argument to be treated atomically as per the other overload. - \sa QProcess::start() + \sa QProcess::start(const QString &command, OpenMode mode) */ /*! @@ -1098,7 +1100,6 @@ bool QProcessPrivate::_q_canReadStandardError() */ bool QProcessPrivate::_q_canWrite() { - Q_Q(QProcess); if (stdinChannel.notifier) stdinChannel.notifier->setEnabled(false); @@ -1109,31 +1110,13 @@ bool QProcessPrivate::_q_canWrite() return false; } - qint64 written = writeToStdin(writeBuffer.readPointer(), writeBuffer.nextDataBlockSize()); - if (written < 0) { - closeChannel(&stdinChannel); - setErrorAndEmit(QProcess::WriteError); - return false; - } - -#if defined QPROCESS_DEBUG - qDebug("QProcessPrivate::canWrite(), wrote %d bytes to the process input", int(written)); -#endif + const bool writeSucceeded = writeToStdin(); - if (written != 0) { - writeBuffer.free(written); - if (!emittedBytesWritten) { - emittedBytesWritten = true; - emit q->bytesWritten(written); - emittedBytesWritten = false; - } - emit q->channelBytesWritten(0, written); - } if (stdinChannel.notifier && !writeBuffer.isEmpty()) stdinChannel.notifier->setEnabled(true); if (writeBuffer.isEmpty() && stdinChannel.closed) closeWriteChannel(); - return true; + return writeSucceeded; } /*! @@ -2531,7 +2514,7 @@ bool QProcess::startDetached(const QString &program, After the \a command string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list. - \sa start() + \sa start(const QString &command, OpenMode mode) */ bool QProcess::startDetached(const QString &command) { |