Doc strings for the spawn* functions, by Michael Hudson.
This commit is contained in:
parent
535f2d9ace
commit
e0cd291b81
56
Lib/os.py
56
Lib/os.py
|
@ -333,17 +333,44 @@ if _exists("fork") and not _exists("spawnv") and _exists("execv"):
|
||||||
raise error, "Not stopped, signaled or exited???"
|
raise error, "Not stopped, signaled or exited???"
|
||||||
|
|
||||||
def spawnv(mode, file, args):
|
def spawnv(mode, file, args):
|
||||||
|
"""spawnv(mode, file, args) -> integer
|
||||||
|
|
||||||
|
Execute file with arguments from args in a subprocess.
|
||||||
|
If mode == P_NOWAIT return the pid of the process.
|
||||||
|
If mode == P_WAIT return the process's exit code if it exits normally;
|
||||||
|
otherwise return - (the signal that killed it). """
|
||||||
return _spawnvef(mode, file, args, None, execv)
|
return _spawnvef(mode, file, args, None, execv)
|
||||||
|
|
||||||
def spawnve(mode, file, args, env):
|
def spawnve(mode, file, args, env):
|
||||||
|
"""spawnve(mode, file, args, env) -> integer
|
||||||
|
|
||||||
|
Execute file with arguments from args in a subprocess with the
|
||||||
|
specified environment.
|
||||||
|
If mode == P_NOWAIT return the pid of the process.
|
||||||
|
If mode == P_WAIT return the process's exit code if it exits normally;
|
||||||
|
otherwise return -SIG, where SIG is the signal that killed it. """
|
||||||
return _spawnvef(mode, file, args, env, execve)
|
return _spawnvef(mode, file, args, env, execve)
|
||||||
|
|
||||||
# Note: spawnvp[e] is't currently supported on Windows
|
# Note: spawnvp[e] is't currently supported on Windows
|
||||||
|
|
||||||
def spawnvp(mode, file, args):
|
def spawnvp(mode, file, args):
|
||||||
|
"""spawnvp(mode, file, args) -> integer
|
||||||
|
|
||||||
|
Execute file (which is looked for along $PATH) with arguments from
|
||||||
|
args in a subprocess.
|
||||||
|
If mode == P_NOWAIT return the pid of the process.
|
||||||
|
If mode == P_WAIT return the process's exit code if it exits normally;
|
||||||
|
otherwise return -SIG, where SIG is the signal that killed it. """
|
||||||
return _spawnvef(mode, file, args, None, execvp)
|
return _spawnvef(mode, file, args, None, execvp)
|
||||||
|
|
||||||
def spawnvpe(mode, file, args, env):
|
def spawnvpe(mode, file, args, env):
|
||||||
|
"""spawnvpe(mode, file, args, env) -> integer
|
||||||
|
|
||||||
|
Execute file (which is looked for along $PATH) with arguments from
|
||||||
|
args in a subprocess with the supplied environment.
|
||||||
|
If mode == P_NOWAIT return the pid of the process.
|
||||||
|
If mode == P_WAIT return the process's exit code if it exits normally;
|
||||||
|
otherwise return -SIG, where SIG is the signal that killed it. """
|
||||||
return _spawnvef(mode, file, args, env, execvpe)
|
return _spawnvef(mode, file, args, env, execvpe)
|
||||||
|
|
||||||
if _exists("spawnv"):
|
if _exists("spawnv"):
|
||||||
|
@ -351,9 +378,22 @@ if _exists("spawnv"):
|
||||||
# but can be easily implemented in Python
|
# but can be easily implemented in Python
|
||||||
|
|
||||||
def spawnl(mode, file, *args):
|
def spawnl(mode, file, *args):
|
||||||
|
"""spawnl(mode, file, *args) -> integer
|
||||||
|
|
||||||
|
Execute file with arguments from args in a subprocess.
|
||||||
|
If mode == P_NOWAIT return the pid of the process.
|
||||||
|
If mode == P_WAIT return the process's exit code if it exits normally;
|
||||||
|
otherwise return -SIG, where SIG is the signal that killed it. """
|
||||||
return spawnv(mode, file, args)
|
return spawnv(mode, file, args)
|
||||||
|
|
||||||
def spawnle(mode, file, *args):
|
def spawnle(mode, file, *args):
|
||||||
|
"""spawnle(mode, file, *args, env) -> integer
|
||||||
|
|
||||||
|
Execute file with arguments from args in a subprocess with the
|
||||||
|
supplied environment.
|
||||||
|
If mode == P_NOWAIT return the pid of the process.
|
||||||
|
If mode == P_WAIT return the process's exit code if it exits normally;
|
||||||
|
otherwise return -SIG, where SIG is the signal that killed it. """
|
||||||
env = args[-1]
|
env = args[-1]
|
||||||
return spawnve(mode, file, args[:-1], env)
|
return spawnve(mode, file, args[:-1], env)
|
||||||
|
|
||||||
|
@ -361,8 +401,24 @@ if _exists("spawnvp"):
|
||||||
# At the moment, Windows doesn't implement spawnvp[e],
|
# At the moment, Windows doesn't implement spawnvp[e],
|
||||||
# so it won't have spawnlp[e] either.
|
# so it won't have spawnlp[e] either.
|
||||||
def spawnlp(mode, file, *args):
|
def spawnlp(mode, file, *args):
|
||||||
|
"""spawnlp(mode, file, *args, env) -> integer
|
||||||
|
|
||||||
|
Execute file (which is looked for along $PATH) with arguments from
|
||||||
|
args in a subprocess with the supplied environment.
|
||||||
|
If mode == P_NOWAIT return the pid of the process.
|
||||||
|
If mode == P_WAIT return the process's exit code if it exits normally;
|
||||||
|
otherwise return -SIG, where SIG is the signal that killed it. """
|
||||||
return spawnvp(mode, file, args)
|
return spawnvp(mode, file, args)
|
||||||
|
|
||||||
def spawnlpe(mode, file, *args):
|
def spawnlpe(mode, file, *args):
|
||||||
|
"""spawnlpe(mode, file, *args, env) -> integer
|
||||||
|
|
||||||
|
Execute file (which is looked for along $PATH) with arguments from
|
||||||
|
args in a subprocess with the supplied environment.
|
||||||
|
If mode == P_NOWAIT return the pid of the process.
|
||||||
|
If mode == P_WAIT return the process's exit code if it exits normally;
|
||||||
|
otherwise return -SIG, where SIG is the signal that killed it. """
|
||||||
env = args[-1]
|
env = args[-1]
|
||||||
return spawnvpe(mode, file, args[:-1], env)
|
return spawnvpe(mode, file, args[:-1], env)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue