summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2011-03-14 18:08:43 (GMT)
committerGregory P. Smith <greg@krypto.org>2011-03-14 18:08:43 (GMT)
commit54d412edcc940560a47a581981d0010f9c3504cb (patch)
tree88e0dae05013ade108e8607d68bc2236a1b13c66 /Lib/subprocess.py
parent1c711f0ef9621cee1b898f0d07d06377921c79e6 (diff)
downloadcpython-54d412edcc940560a47a581981d0010f9c3504cb.zip
cpython-54d412edcc940560a47a581981d0010f9c3504cb.tar.gz
cpython-54d412edcc940560a47a581981d0010f9c3504cb.tar.bz2
Add a SubprocessError base class for exceptions in the subprocess module.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index c8af5d1..874aea7 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -191,8 +191,10 @@ should prepare for OSErrors.
A ValueError will be raised if Popen is called with invalid arguments.
-check_call() and check_output() will raise CalledProcessError, if the
-called process returns a non-zero return code.
+Exceptions defined within this module inherit from SubprocessError.
+check_call() and check_output() will raise CalledProcessError if the
+called process returns a non-zero return code. TimeoutExpired
+be raised if a timeout was specified and expired.
Security
@@ -348,7 +350,10 @@ import builtins
import warnings
# Exception classes used by this module.
-class CalledProcessError(Exception):
+class SubprocessError(Exception): pass
+
+
+class CalledProcessError(SubprocessError):
"""This exception is raised when a process run by check_call() or
check_output() returns a non-zero exit status.
The exit status will be stored in the returncode attribute;
@@ -362,7 +367,7 @@ class CalledProcessError(Exception):
return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
-class TimeoutExpired(Exception):
+class TimeoutExpired(SubprocessError):
"""This exception is raised when the timeout expires while waiting for a
child process.
"""