summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_win.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2021-09-11 17:32:09 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2021-09-18 13:50:28 +0300
commitb2c3b3e8fe0d8bdc88051d0120aaa8d5cf8acce0 (patch)
tree6d3bdfc75dfb1870202b82ef4fcba19e30d6ede6 /src/corelib/io/qprocess_win.cpp
parentf4aaba593c743af870fe224b4186225d67b617fc (diff)
Q{LocalSocket|Process}/Win: handle write errors
To match the Unix behavior, we should emit errorOccurred() signal and close the channel if the write operation fails. Change-Id: Iac3acb18dbbfe6e7e8afb2555d9adaff1fe98d0f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/io/qprocess_win.cpp')
-rw-r--r--src/corelib/io/qprocess_win.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index f935e4f491..b2e8beaa53 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -841,6 +841,8 @@ qint64 QProcess::writeData(const char *data, qint64 len)
d->stdinChannel.writer = new QWindowsPipeWriter(d->stdinChannel.pipe[1], this);
QObjectPrivate::connect(d->stdinChannel.writer, &QWindowsPipeWriter::bytesWritten,
d, &QProcessPrivate::_q_bytesWritten);
+ QObjectPrivate::connect(d->stdinChannel.writer, &QWindowsPipeWriter::writeFailed,
+ d, &QProcessPrivate::_q_writeFailed);
}
if (d->isWriteChunkCached(data, len))
@@ -872,6 +874,12 @@ void QProcessPrivate::_q_bytesWritten(qint64 bytes)
closeWriteChannel();
}
+void QProcessPrivate::_q_writeFailed()
+{
+ closeWriteChannel();
+ setErrorAndEmit(QProcess::WriteError);
+}
+
// Use ShellExecuteEx() to trigger an UAC prompt when CreateProcess()fails
// with ERROR_ELEVATION_REQUIRED.
static bool startDetachedUacPrompt(const QString &programIn, const QStringList &arguments,