bpo-13826: Clarify Popen constructor example (GH-18438) · python/cpython@e6690f6 (original) (raw)
`@@ -355,14 +355,20 @@ functions.
`
355
355
` arguments for additional differences from the default behavior. Unless
`
356
356
` otherwise stated, it is recommended to pass args as a sequence.
`
357
357
``
``
358
`+
An example of passing some arguments to an external program
`
``
359
`+
as a sequence is::
`
``
360
+
``
361
`+
Popen(["/usr/bin/git", "commit", "-m", "Fixes a bug."])
`
``
362
+
358
363
` On POSIX, if args is a string, the string is interpreted as the name or
`
359
364
` path of the program to execute. However, this can only be done if not
`
360
365
` passing arguments to the program.
`
361
366
``
362
367
` .. note::
`
363
368
``
364
``
`` -
:meth:shlex.split
can be useful when determining the correct
``
365
``
`-
tokenization for args, especially in complex cases::
`
``
369
`+
It may not be obvious how to break a shell command into a sequence of arguments,
`
``
370
`` +
especially in complex cases. :meth:shlex.split
can illustrate how to
``
``
371
`+
determine the correct tokenization for args::
`
366
372
``
367
373
` >>> import shlex, subprocess
`
368
374
` >>> command_line = input()
`