[28139] in Source-Commits
locker-support commit: Exit with correct status and output
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Fri Apr 4 13:08:05 2014
Date: Fri, 4 Apr 2014 13:07:58 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201404041707.s34H7wPX012832@drugstore.mit.edu>
To: source-commits@MIT.EDU
https://github.com/mit-athena/locker-support/commit/285c7c2779fc478b3a372b2c2fb0de64032b0461
commit 285c7c2779fc478b3a372b2c2fb0de64032b0461
Author: Jonathan Reed <jdreed@mit.edu>
Date: Fri Apr 4 08:15:53 2014 -0400
Exit with correct status and output
Fix athdir so that it correctly exits with status 1 if no paths
were found. Also, it should not print anything if no paths were
found (previously, it printed a blank line).
athdir | 11 +++++++----
setup.py | 2 +-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/athdir b/athdir
index 2d3a34b..a570d80 100755
--- a/athdir
+++ b/athdir
@@ -62,8 +62,10 @@ if len(sys.argv) < 2:
# This is the first invocation. There's probably a better way.
if len(sys.argv) <= 3 and not any(x.startswith('-') for x in sys.argv):
a = athdir.Athdir(sys.argv[1], sys.argv[2] if len(sys.argv) == 3 else 'bin')
- print ''.join(a.get_paths())
- sys.exit(0)
+ paths = a.get_paths()
+ if len(paths) > 0:
+ print ''.join(paths)
+ sys.exit(0 if len(paths) > 0 else 1)
(options, args) = parser.parse_args()
if options.debug:
@@ -86,5 +88,6 @@ for p in options.lockerpath:
paths += a.get_paths(options.suppressEditorials, options.suppressSearch,
options.forceDependent, options.forceIndependent,
options.listAll)
-print options.recsep.join(paths)
-sys.exit(0)
+if len(paths) > 0:
+ print options.recsep.join(paths)
+sys.exit(0 if len(paths) > 0 else 1)
diff --git a/setup.py b/setup.py
index 7389608..bc59d72 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
from distutils.core import setup
setup(name='locker-support',
- version='10.4.4',
+ version='10.4.5',
author='Debathena Project',
author_email='debathena@mit.edu',
py_modules=['locker', 'athdir'],