Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0cd291

Browse files
committed
Doc strings for the spawn* functions, by Michael Hudson.
1 parent 535f2d9 commit e0cd291

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Lib/os.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,36 +333,92 @@ def _spawnvef(mode, file, args, env, func):
333333
raise error, "Not stopped, signaled or exited???"
334334

335335
def spawnv(mode, file, args):
336+
"""spawnv(mode, file, args) -> integer
337+
338+
Execute file with arguments from args in a subprocess.
339+
If mode == P_NOWAIT return the pid of the process.
340+
If mode == P_WAIT return the process's exit code if it exits normally;
341+
otherwise return - (the signal that killed it). """
336342
return _spawnvef(mode, file, args, None, execv)
337343

338344
def spawnve(mode, file, args, env):
345+
"""spawnve(mode, file, args, env) -> integer
346+
347+
Execute file with arguments from args in a subprocess with the
348+
specified environment.
349+
If mode == P_NOWAIT return the pid of the process.
350+
If mode == P_WAIT return the process's exit code if it exits normally;
351+
otherwise return -SIG, where SIG is the signal that killed it. """
339352
return _spawnvef(mode, file, args, env, execve)
340353

341354
# Note: spawnvp[e] is't currently supported on Windows
342355

343356
def spawnvp(mode, file, args):
357+
"""spawnvp(mode, file, args) -> integer
358+
359+
Execute file (which is looked for along $PATH) with arguments from
360+
args in a subprocess.
361+
If mode == P_NOWAIT return the pid of the process.
362+
If mode == P_WAIT return the process's exit code if it exits normally;
363+
otherwise return -SIG, where SIG is the signal that killed it. """
344364
return _spawnvef(mode, file, args, None, execvp)
345365

346366
def spawnvpe(mode, file, args, env):
367+
"""spawnvpe(mode, file, args, env) -> integer
368+
369+
Execute file (which is looked for along $PATH) with arguments from
370+
args in a subprocess with the supplied environment.
371+
If mode == P_NOWAIT return the pid of the process.
372+
If mode == P_WAIT return the process's exit code if it exits normally;
373+
otherwise return -SIG, where SIG is the signal that killed it. """
347374
return _spawnvef(mode, file, args, env, execvpe)
348375

349376
if _exists("spawnv"):
350377
# These aren't supplied by the basic Windows code
351378
# but can be easily implemented in Python
352379

353380
def spawnl(mode, file, *args):
381+
"""spawnl(mode, file, *args) -> integer
382+
383+
Execute file with arguments from args in a subprocess.
384+
If mode == P_NOWAIT return the pid of the process.
385+
If mode == P_WAIT return the process's exit code if it exits normally;
386+
otherwise return -SIG, where SIG is the signal that killed it. """
354387
return spawnv(mode, file, args)
355388

356389
def spawnle(mode, file, *args):
390+
"""spawnle(mode, file, *args, env) -> integer
391+
392+
Execute file with arguments from args in a subprocess with the
393+
supplied environment.
394+
If mode == P_NOWAIT return the pid of the process.
395+
If mode == P_WAIT return the process's exit code if it exits normally;
396+
otherwise return -SIG, where SIG is the signal that killed it. """
357397
env = args[-1]
358398
return spawnve(mode, file, args[:-1], env)
359399

360400
if _exists("spawnvp"):
361401
# At the moment, Windows doesn't implement spawnvp[e],
362402
# so it won't have spawnlp[e] either.
363403
def spawnlp(mode, file, *args):
404+
"""spawnlp(mode, file, *args, env) -> integer
405+
406+
Execute file (which is looked for along $PATH) with arguments from
407+
args in a subprocess with the supplied environment.
408+
If mode == P_NOWAIT return the pid of the process.
409+
If mode == P_WAIT return the process's exit code if it exits normally;
410+
otherwise return -SIG, where SIG is the signal that killed it. """
364411
return spawnvp(mode, file, args)
365412

366413
def spawnlpe(mode, file, *args):
414+
"""spawnlpe(mode, file, *args, env) -> integer
415+
416+
Execute file (which is looked for along $PATH) with arguments from
417+
args in a subprocess with the supplied environment.
418+
If mode == P_NOWAIT return the pid of the process.
419+
If mode == P_WAIT return the process's exit code if it exits normally;
420+
otherwise return -SIG, where SIG is the signal that killed it. """
367421
env = args[-1]
368422
return spawnvpe(mode, file, args[:-1], env)
423+
424+

0 commit comments

Comments
 (0)