Fix bug 937 - "missing pid method in QProcess"
This commit is contained in:
parent
0b6bafdd44
commit
5902ca2e66
2 changed files with 26 additions and 1 deletions
|
|
@ -240,7 +240,6 @@
|
||||||
<rejection class="QCoreApplication" function-name="setEventFilter"/>
|
<rejection class="QCoreApplication" function-name="setEventFilter"/>
|
||||||
<rejection class="QFile" function-name="setDecodingFunction"/>
|
<rejection class="QFile" function-name="setDecodingFunction"/>
|
||||||
<rejection class="QFile" function-name="setEncodingFunction"/>
|
<rejection class="QFile" function-name="setEncodingFunction"/>
|
||||||
<rejection class="QProcess" function-name="pid"/>
|
|
||||||
<rejection class="QRegion" function-name="cleanUp"/>
|
<rejection class="QRegion" function-name="cleanUp"/>
|
||||||
<rejection class="QSettings" function-name="registerFormat"/>
|
<rejection class="QSettings" function-name="registerFormat"/>
|
||||||
<rejection class="QAbstractFileEngineIterator" function-name="entryInfo"/>
|
<rejection class="QAbstractFileEngineIterator" function-name="entryInfo"/>
|
||||||
|
|
@ -2378,6 +2377,20 @@
|
||||||
%PYARG_0 = Shiboken::makeTuple(retval, pid);
|
%PYARG_0 = Shiboken::makeTuple(retval, pid);
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</modify-function>
|
</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-->
|
<!--### Obsolete in 4.3-->
|
||||||
<modify-function signature="setReadChannelMode(QProcess::ProcessChannelMode)" remove="all"/>
|
<modify-function signature="setReadChannelMode(QProcess::ProcessChannelMode)" remove="all"/>
|
||||||
<modify-function signature="readChannelMode()const" remove="all"/>
|
<modify-function signature="readChannelMode()const" remove="all"/>
|
||||||
|
|
|
||||||
|
|
@ -12,5 +12,17 @@ class TestQProcess (unittest.TestCase):
|
||||||
self.assert_(isinstance(value, bool))
|
self.assert_(isinstance(value, bool))
|
||||||
self.assert_(isinstance(pid, long))
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue