diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-07-21 17:12:49 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-07-21 17:12:49 -0300 |
commit | f1b330231afb8cb8662c62b2b2b6ec1166e71ca0 (patch) | |
tree | 8e3ea0d72cc84d6a649e0aa6e0edd58956a4de5f | |
parent | 239ae999fa0d07893e5e29f611d1919374853b2f (diff) | |
download | pyside-f1b330231afb8cb8662c62b2b2b6ec1166e71ca0.tar.gz pyside-f1b330231afb8cb8662c62b2b2b6ec1166e71ca0.tar.xz pyside-f1b330231afb8cb8662c62b2b2b6ec1166e71ca0.zip |
Fix bug 937 - "missing pid method in QProcess"
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 15 | ||||
-rw-r--r-- | tests/QtCore/qprocess_test.py | 12 |
2 files changed, 26 insertions, 1 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 2ed071e..7c98d42 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -240,7 +240,6 @@ <rejection class="QCoreApplication" function-name="setEventFilter"/> <rejection class="QFile" function-name="setDecodingFunction"/> <rejection class="QFile" function-name="setEncodingFunction"/> - <rejection class="QProcess" function-name="pid"/> <rejection class="QRegion" function-name="cleanUp"/> <rejection class="QSettings" function-name="registerFormat"/> <rejection class="QAbstractFileEngineIterator" function-name="entryInfo"/> @@ -2386,6 +2385,20 @@ %PYARG_0 = Shiboken::makeTuple(retval, pid); </inject-code> </modify-function> + <!-- Function removed because on windows it returns a win32 specific structure --> + <modify-function signature="pid()const" remove="all" /> + <add-function signature="pid()" return-type="long"> + <inject-code> + long result; + #ifdef WIN32 + _PROCESS_INFORMATION* procInfo = %CPPSELF.%FUNCTION_NAME(); + result = procInfo ? procInfo->dwProcessId : 0; + #else + result = %CPPSELF.%FUNCTION_NAME(); + #endif + %PYARG_0 = %CONVERTTOPYTHON[long](result); + </inject-code> + </add-function> <!--### Obsolete in 4.3--> <modify-function signature="setReadChannelMode(QProcess::ProcessChannelMode)" remove="all"/> <modify-function signature="readChannelMode()const" remove="all"/> diff --git a/tests/QtCore/qprocess_test.py b/tests/QtCore/qprocess_test.py index b01c68b..19d47f6 100644 --- a/tests/QtCore/qprocess_test.py +++ b/tests/QtCore/qprocess_test.py @@ -12,5 +12,17 @@ class TestQProcess (unittest.TestCase): self.assert_(isinstance(value, bool)) self.assert_(isinstance(pid, long)) + def testPid(self): + p = QProcess() + p.start("dir") + p.waitForStarted() + pid = p.pid() + # We can't test the pid method result because it returns 0 when the + # process isn't running + if p.state() == QProcess.Running: + self.assertNotEqual(pid, 0) + else: + print "PROCESS ALREADY DEAD :-/" + if __name__ == '__main__': unittest.main() |