summaryrefslogtreecommitdiffstats
path: root/Doc/lib
diff options
context:
space:
mode:
authorPeter Astrand <astrand@lysator.liu.se>2005-01-01 09:36:35 (GMT)
committerPeter Astrand <astrand@lysator.liu.se>2005-01-01 09:36:35 (GMT)
commit454f76711c14f0a55119601bfe56a1ab5d2c0e04 (patch)
treef81416ce45244479ab525018c0b2078f8d591946 /Doc/lib
parented2dbe3f3344038dee8389f0ade335da1b3b559a (diff)
downloadcpython-454f76711c14f0a55119601bfe56a1ab5d2c0e04.zip
cpython-454f76711c14f0a55119601bfe56a1ab5d2c0e04.tar.gz
cpython-454f76711c14f0a55119601bfe56a1ab5d2c0e04.tar.bz2
New subprocess utility function: check_call. Closes #1071764.
Diffstat (limited to 'Doc/lib')
-rw-r--r--Doc/lib/libsubprocess.tex18
1 files changed, 17 insertions, 1 deletions
diff --git a/Doc/lib/libsubprocess.tex b/Doc/lib/libsubprocess.tex
index 308c1dd..5a2a835 100644
--- a/Doc/lib/libsubprocess.tex
+++ b/Doc/lib/libsubprocess.tex
@@ -120,7 +120,7 @@ process. (Windows only)
\subsubsection{Convenience Functions}
-This module also defines one shortcut function:
+This module also defines two shortcut functions:
\begin{funcdesc}{call}{*popenargs, **kwargs}
Run command with arguments. Wait for command to complete, then
@@ -133,6 +133,18 @@ The arguments are the same as for the Popen constructor. Example:
\end{verbatim}
\end{funcdesc}
+\begin{funcdesc}{check_call}{*popenargs, **kwargs}
+Run command with arguments. Wait for command to complete. If the exit
+code was zero then return, otherwise raise CalledProcessError. The
+CalledProcessError object will have the return code in the
+\member{errno} attribute.
+
+The arguments are the same as for the Popen constructor. Example:
+
+\begin{verbatim}
+ check_call(["ls", "-l"])
+\end{verbatim}
+\end{funcdesc}
\subsubsection{Exceptions}
@@ -149,6 +161,10 @@ should prepare for \exception{OSError} exceptions.
A \exception{ValueError} will be raised if \class{Popen} is called
with invalid arguments.
+check_call() will raise \exception{CalledProcessError}, which is a
+subclass of \exception{OSError}, if the called process returns a
+non-zero return code.
+
\subsubsection{Security}