summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/Lib/os.py b/Lib/os.py
index dc1ef5a..7322fa5 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -38,3 +38,33 @@ except ImportError:
import macpath
path = macpath
del macpath
+
+def execl(file, *args):
+ execv(file, args)
+
+def execle(file, *args):
+ env = args[-1]
+ execve(file, args[:-1], env)
+
+def execlp(file, *args):
+ execvp(file, args)
+
+def execvp(file, args):
+ if '/' in file:
+ execv(file, args)
+ return
+ ENOENT = 2
+ if environ.has_key('PATH'):
+ import string
+ PATH = string.splitfields(environ['PATH'], ':')
+ else:
+ PATH = ['', '/bin', '/usr/bin']
+ exc, arg = (ENOENT, 'No such file or directory')
+ for dir in PATH:
+ fullname = path.join(dir, file)
+ try:
+ execv(fullname, args)
+ except error, (errno, msg):
+ if errno != ENOENT:
+ exc, arg = error, (errno, msg)
+ raise exc, arg