aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PySide/QtCore/typesystem_core.xml15
-rw-r--r--tests/QtCore/qprocess_test.py12
2 files changed, 26 insertions, 1 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index fe3849233..3a764c90d 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"/>
@@ -2378,6 +2377,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 b01c68ba3..19d47f68a 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()