mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Make call of os.getppid() conditional: it is not available on Windows.
This commit is contained in:
parent
1014686d76
commit
e683ef55fc
1 changed files with 2 additions and 1 deletions
|
@ -81,6 +81,7 @@ To show the individual process IDs involved, here is an expanded example::
|
||||||
def info(title):
|
def info(title):
|
||||||
print title
|
print title
|
||||||
print 'module name:', __name__
|
print 'module name:', __name__
|
||||||
|
if hasattr(os, 'getppid'): # only available on Unix
|
||||||
print 'parent process:', os.getppid()
|
print 'parent process:', os.getppid()
|
||||||
print 'process id:', os.getpid()
|
print 'process id:', os.getpid()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue