summaryrefslogtreecommitdiffstats
path: root/Lib/py_compile.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-03-06 07:41:16 (GMT)
committerGeorg Brandl <georg@python.org>2008-03-06 07:41:16 (GMT)
commita7bd27f0a8dd7acbf0098f50d28ed9783fdce605 (patch)
tree4968123959c62ef2f90daae5e377858d919acb3f /Lib/py_compile.py
parent810ea29b0ea0369be6fb401f27863be03c4c4690 (diff)
downloadcpython-a7bd27f0a8dd7acbf0098f50d28ed9783fdce605.zip
cpython-a7bd27f0a8dd7acbf0098f50d28ed9783fdce605.tar.gz
cpython-a7bd27f0a8dd7acbf0098f50d28ed9783fdce605.tar.bz2
#2225: return nonzero status code from py_compile if not all files could be compiled.
Diffstat (limited to 'Lib/py_compile.py')
-rw-r--r--Lib/py_compile.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/py_compile.py b/Lib/py_compile.py
index 1cb41f1..89e80f8 100644
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -154,11 +154,15 @@ def main(args=None):
"""
if args is None:
args = sys.argv[1:]
+ rv = 0
for filename in args:
try:
compile(filename, doraise=True)
- except PyCompileError,err:
+ except PyCompileError, err:
+ # return value to indicate at least one failure
+ rv = 1
sys.stderr.write(err.msg)
+ return rv
if __name__ == "__main__":
- main()
+ sys.exit(main())