@@ -4210,15 +4210,6 @@ Process Management
42104210
42114211These functions may be used to create and manage processes.
42124212
4213- The various :func: `exec\* <execl> ` functions take a list of arguments for the new
4214- program loaded into the process. In each case, the first of these arguments is
4215- passed to the new program as its own name rather than as an argument a user may
4216- have typed on a command line. For the C programmer, this is the ``argv[0] ``
4217- passed to a program's :c:func: `main `. For example, ``os.execv('/bin/echo',
4218- ['foo', 'bar']) `` will only print ``bar `` on standard output; ``foo `` will seem
4219- to be ignored.
4220-
4221-
42224213.. function :: abort()
42234214
42244215 Generate a :const: `SIGABRT ` signal to the current process. On Unix, the default
@@ -4280,6 +4271,20 @@ to be ignored.
42804271 :func: `sys.stdout.flush ` or :func: `os.fsync ` before calling an
42814272 :func: `exec\* <execl> ` function.
42824273
4274+ *Arguments *
4275+
4276+ The various :func: `exec\* <execl> ` functions take a list of arguments for the new
4277+ program loaded into the process. In each case, the first of these arguments must
4278+ be the name of the program itself, and not an argument that a user may
4279+ have typed on a command line.
4280+
4281+ For the C programmer, this is the ``argv[0] ``
4282+ passed to a program's :c:func: `main `. For example, ``os.execv('/bin/echo',
4283+ ['foo', 'bar']) `` will only print ``bar `` on standard output; ``foo `` will seem
4284+ to be ignored.
4285+
4286+ *Fixed and variable numbers of arguments *
4287+
42834288 The "l" and "v" variants of the :func: `exec\* <execl> ` functions differ in how
42844289 command-line arguments are passed. The "l" variants are perhaps the easiest
42854290 to work with if the number of parameters is fixed when the code is written; the
@@ -4289,29 +4294,35 @@ to be ignored.
42894294 parameter. In either case, the arguments to the child process should start with
42904295 the name of the command being run, but this is not enforced.
42914296
4297+ *The location of the executable *
4298+
42924299 The variants which include a "p" near the end (:func: `execlp `,
42934300 :func: `execlpe `, :func: `execvp `, and :func: `execvpe `) will use the
42944301 :envvar: `PATH ` environment variable to locate the program *file *. When the
42954302 environment is being replaced (using one of the :func: `exec\* e <execl> ` variants,
42964303 discussed in the next paragraph), the new environment is used as the source of
4297- the :envvar: `PATH ` variable. The other variants, :func: `execl `, :func: `execle `,
4304+ the :envvar: `PATH ` variable.
4305+
4306+ The other variants, :func: `execl `, :func: `execle `,
42984307 :func: `execv `, and :func: `execve `, will not use the :envvar: `PATH ` variable to
42994308 locate the executable; *path * must contain an appropriate absolute or relative
43004309 path. Relative paths must include at least one slash, even on Windows, as
43014310 plain names will not be resolved.
43024311
4312+ For :func: `execve ` on some platforms, *path * may also be specified as an open
4313+ file descriptor. This functionality may not be supported on your platform;
4314+ you can check whether or not it is available using :data: `os.supports_fd `.
4315+ If it is unavailable, using it will raise a :exc: `NotImplementedError `.
4316+
4317+ *Environment variables *
4318+
43034319 For :func: `execle `, :func: `execlpe `, :func: `execve `, and :func: `execvpe ` (note
43044320 that these all end in "e"), the *env * parameter must be a mapping which is
43054321 used to define the environment variables for the new process (these are used
43064322 instead of the current process' environment); the functions :func: `execl `,
43074323 :func: `execlp `, :func: `execv `, and :func: `execvp ` all cause the new process to
43084324 inherit the environment of the current process.
43094325
4310- For :func: `execve ` on some platforms, *path * may also be specified as an open
4311- file descriptor. This functionality may not be supported on your platform;
4312- you can check whether or not it is available using :data: `os.supports_fd `.
4313- If it is unavailable, using it will raise a :exc: `NotImplementedError `.
4314-
43154326 .. audit-event :: os.exec path,args,env os.execl
43164327
43174328 .. availability :: Unix, Windows, not WASI, not Android, not iOS.
0 commit comments