summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorNicholas Riley <nriley@sabi.net>2000-09-24 06:28:47 (GMT)
committerNicholas Riley <nriley@sabi.net>2000-09-24 06:28:47 (GMT)
commit21afd01ce22f898dc19e88d31c76da1ea2596b96 (patch)
tree12b6ab3be468a61872836b1c03c5488ed5e7fbed /Lib/idlelib
parent1f54902e05de94848fe728a24baf14dd605a65de (diff)
downloadcpython-21afd01ce22f898dc19e88d31c76da1ea2596b96.zip
cpython-21afd01ce22f898dc19e88d31c76da1ea2596b96.tar.gz
cpython-21afd01ce22f898dc19e88d31c76da1ea2596b96.tar.bz2
Change for Python 1.6 compatibility - UNIX's 'os' module defines
'spawnv' now, so we check for 'fork' first.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/spawn.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/Lib/idlelib/spawn.py b/Lib/idlelib/spawn.py
index ce6b41c..22617ed 100644
--- a/Lib/idlelib/spawn.py
+++ b/Lib/idlelib/spawn.py
@@ -13,22 +13,7 @@ def hardpath(path):
pass
return path
-if hasattr(os, 'spawnv'):
-
- # Windows-ish OS: we use spawnv(), and stick quotes around arguments
- # in case they contains spaces, since Windows will jam all the
- # arguments to spawn() or exec() together into one string. The
- # kill_zombies function is a noop.
-
- def spawn(bin, *args):
- nargs = [bin]
- for arg in args:
- nargs.append( '"'+arg+'"' )
- os.spawnv( os.P_NOWAIT, bin, nargs )
-
- def kill_zombies(): pass
-
-elif hasattr(os, 'fork'):
+if hasattr(os, 'fork'):
# UNIX-ish operating system: we fork() and exec(), and we have to track
# the pids of our children and call waitpid() on them to avoid leaving
@@ -49,6 +34,20 @@ elif hasattr(os, 'fork'):
stat = os.waitpid(z, os.WNOHANG)
if stat[0]==z:
zombies.remove(z)
+elif hasattr(os, 'spawnv'):
+
+ # Windows-ish OS: we use spawnv(), and stick quotes around arguments
+ # in case they contains spaces, since Windows will jam all the
+ # arguments to spawn() or exec() together into one string. The
+ # kill_zombies function is a noop.
+
+ def spawn(bin, *args):
+ nargs = [bin]
+ for arg in args:
+ nargs.append( '"'+arg+'"' )
+ os.spawnv( os.P_NOWAIT, bin, nargs )
+
+ def kill_zombies(): pass
else:
# If you get here, you may be able to write an alternative implementation