bpo-23750: Document os-system, subprocess. Patch by Martin Panter. (GH-26016) (GH-26040)
* Document os-system, subprocess Patch
* Update Doc/library/os.rst
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 5f2eb87f2893c5e77ade4d662cebcce59d3f2c2f)
Co-authored-by: uniocto <serit142sa33go@gmail.com>
Co-authored-by: uniocto <serit142sa33go@gmail.com>
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index b60db58..56b6b6e 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -1292,11 +1292,17 @@
sts = os.system("mycmd" + " myarg")
# becomes
- sts = call("mycmd" + " myarg", shell=True)
+ retcode = call("mycmd" + " myarg", shell=True)
Notes:
* Calling the program through the shell is usually not required.
+* The :func:`call` return value is encoded differently to that of
+ :func:`os.system`.
+
+* The :func:`os.system` function ignores SIGINT and SIGQUIT signals while
+ the command is running, but the caller must do this separately when
+ using the :mod:`subprocess` module.
A more realistic example would look like this::