[Python-checkins] python/dist/src/Doc/lib libsubprocess.tex, 1.4,
1.5
astrand at users.sourceforge.net
astrand at users.sourceforge.net
Sat Jan 1 10:36:38 CET 2005
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24099/Doc/lib
Modified Files:
libsubprocess.tex
Log Message:
New subprocess utility function: check_call. Closes #1071764.
Index: libsubprocess.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsubprocess.tex,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- libsubprocess.tex 5 Dec 2004 20:15:36 -0000 1.4
+++ libsubprocess.tex 1 Jan 2005 09:36:35 -0000 1.5
@@ -120,7 +120,7 @@
\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 @@
\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 @@
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}
More information about the Python-checkins
mailing list