@@ -942,24 +942,58 @@ \subsection{Process Management \label{os-process}}
942942functions are described in section \ref {os-newstreams }.
943943\end {funcdescni }
944944
945- \begin {funcdesc }{spawnv}{mode, path, args}
946- Execute the program \var {path} in a new process, passing the arguments
947- specified in \var {args} as command-line parameters. \var {args} may be
948- a list or a tuple. \var {mode} is a magic operational constant. See
949- the Visual \Cpp {} Runtime Library documentation for further
950- information; the constants are exposed to the Python programmer as
951- listed below.
952- Availability: \UNIX {}, Windows.
953- \versionadded {1.6}
954- \end {funcdesc }
945+ \begin {funcdesc }{spawnl}{mode, path, \moreargs }
946+ \funcline {spawnle}{mode, path, \moreargs , env}
947+ \funcline {spawnlp}{mode, path, \moreargs }
948+ \funcline {spawnlpe}{mode, path, \moreargs , env}
949+ \funcline {spawnv}{mode, path, args}
950+ \funcline {spawnve}{mode, path, args, env}
951+ \funcline {spawnvp}{mode, path, args}
952+ \funcline {spawnvpe}{mode, path, args, env}
953+ Execute the program \var {path} in a new process. If \var {mode} is
954+ \constant {P_NOWAIT}, this function returns the process ID of the new
955+ process; it \var {mode} is \constant {P_WAIT}, returns the process's
956+ exit code if it exits normally, or \code {-\var {signal}}, where
957+ \var {signal} is the signal that killed the process.
958+
959+ For \function {spawnle()}, \function {spawnlpe()}, \function {spawnve()},
960+ and \function {spawnvpe()} (note that these all end in \character {e}),
961+ the \var {env} parameter must be a mapping which is used to define the
962+ environment variables for the new process; the \function {spawnl()},
963+ \function {spawnlp()}, \function {spawnv()}, and \function {spawnvp()}
964+ all cause the new process to inherit the environment of the current
965+ process.
966+
967+ The variants which include a second \character {p} near the end
968+ (\function {spawnlp()}, \function {spawnlpe()}, \function {spawnvp()},
969+ and \function {spawnvpe()}) will use the \envvar {PATH} environment
970+ variable to locate the program \var {path}. The other variants,
971+ \function {spawnl()}, \function {spawnle()}, \function {spawnv()}, and
972+ \function {spawnve()}, will not use the \envvar {PATH} variable to
973+ locate the executable.
974+
975+ The \character {l} and \character {v} variants of the
976+ \function {spawn*()} functions differ in how command-line arguments are
977+ passed. The \character {l} variants are perhaps the easiest to work
978+ with if the number of parameters is fixed when the code is written;
979+ the individual parameters simply become additional parameters to the
980+ \function {spawnl*()} functions. The \character {v} variants are good
981+ when the number of parameters is variable, with the arguments being
982+ passed in a list or tuple as the \var {args} parameter. In either
983+ case, the arguments to the child process must start with the name of
984+ the command being run.
985+
986+ As an example, the following calls to \function {spawnlp()} and
987+ \function {spawnvpe()} are equivalent:
988+
989+ \begin {verbatim }
990+ import os
991+ os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')
992+
993+ L = ['cp', 'index.html', '/dev/null']
994+ os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)
995+ \end {verbatim }
955996
956- \begin {funcdesc }{spawnve}{mode, path, args, env}
957- Execute the program \var {path} in a new process, passing the arguments
958- specified in \var {args} as command-line parameters and the contents of
959- the mapping \var {env} as the environment. \var {args} may be a list or
960- a tuple. \var {mode} is a magic operational constant. See the Visual
961- \Cpp {} Runtime Library documentation for further information; the
962- constants are exposed to the Python programmer as listed below.
963997Availability: \UNIX {}, Windows.
964998\versionadded {1.6}
965999\end {funcdesc }
0 commit comments