summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r--src/corelib/io/qprocess.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 96cec568df..d473281acc 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1317,6 +1317,10 @@ void QProcess::closeWriteChannel()
object will be in read-only mode (calling write() will result in
error).
+ To make the process read EOF right away, pass nullDevice() here.
+ This is cleaner than using closeWriteChannel() before writing any
+ data, because it can be set up prior to starting the process.
+
If the file \a fileName does not exist at the moment start() is
called or is not readable, starting the process will fail.
@@ -1340,6 +1344,10 @@ void QProcess::setStandardInputFile(const QString &fileName)
read channel is closed: reading from it using read() will always
fail, as will readAllStandardOutput().
+ To discard all standard output from the process, pass nullDevice()
+ here. This is more efficient than simply never reading the standard
+ output, as no QProcess buffers are filled.
+
If the file \a fileName doesn't exist at the moment start() is
called, it will be created. If it cannot be created, the starting
will fail.
@@ -2440,6 +2448,25 @@ QStringList QProcess::systemEnvironment()
*/
/*!
+ \since 5.2
+
+ \brief The null device of the operating system.
+
+ The returned file path uses native directory separators.
+
+ \sa QProcess::setStandardInputFile(), QProcess::setStandardOutputFile(),
+ QProcess::setStandardErrorFile()
+*/
+QString QProcess::nullDevice()
+{
+#ifdef Q_OS_WIN
+ return QStringLiteral("\\\\.\\NUL");
+#else
+ return QStringLiteral("/dev/null");
+#endif
+}
+
+/*!
\typedef Q_PID
\relates QProcess