diff options
author | Christian Strømme <christian.stromme@digia.com> | 2014-01-21 14:54:27 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-14 00:34:25 +0100 |
commit | 2223cc8a2d91968951432f337fa4737cf792d514 (patch) | |
tree | 8a878ff4b0cb17421a005d61c13a74a3aaef972e /tests | |
parent | 9dc7c92dcb17ef503df18270aa68eabb67623bae (diff) |
Add function to get the actual PID from QProcess
It was not possible to get the actual process ID (in a cross-platform
manner) from QProcess, as the user would need to handle the returned
typedef (Q_PID) differently on Unix and Windows.
On Unix Q_PID is the actual process ID, but on Windows it's a pointer
to a PROCESS_INFORMATION structure, which among other fields contains
the process ID. Instead of returning a pointer on Windows,
QProcess::processId() will return the actual process ID on both Windows
and Unix.
[ChangeLog][QtCore][QProcess] Added processId() to QProcess. This
function will, unlike pid(), return the actual process identifier on
both Window and Unix.
Task-number: QTBUG-26136
Change-Id: I853ab721297e2dd9cda006666144179a9e25b73d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 37f224ff28..f5aa2c2412 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -943,7 +943,7 @@ void tst_QProcess::hardExit() void tst_QProcess::softExit() { QProcess proc; - + QCOMPARE(proc.processId(), 0); proc.start("testSoftExit/testSoftExit"); QVERIFY(proc.waitForStarted(10000)); @@ -951,6 +951,8 @@ void tst_QProcess::softExit() QVERIFY(proc.waitForReadyRead(10000)); #endif + QVERIFY(proc.processId() > 0); + proc.terminate(); QVERIFY(proc.waitForFinished(10000)); |