Skip to content

Commit 8d4d010

Browse files
committed
gh-125562: Rewording of documentation for execl function
1 parent d339d8f commit 8d4d010

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

Doc/library/os.rst

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4273,17 +4273,12 @@ These functions may be used to create and manage processes.
42734273

42744274
*Program arguments*
42754275

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.
4276+
The exec functions take a list of arguments for the new program. The first of these
4277+
is by convention the command name used on the command line, rather than an argument to the command,
4278+
and becomes argv[0] passed to the main function of a C program.
42804279

4281-
This first argument is equivalent to the ``argv[0]``
4282-
passed to a program's :c:func:`main` in a C program. 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*
4280+
For example, ``os.execv('/bin/echo', ['echo', 'foo', 'bar'])`` would only print ``foo bar``;
4281+
the echo argument would seem to be ignored.
42874282

42884283
The "l" and "v" variants of the :func:`exec\* <execl>` functions differ in how
42894284
command-line arguments are passed. The "l" variants are perhaps the easiest

0 commit comments

Comments
 (0)