فهرست منبع

celeryctl: sys.exit(str) will output the string to stdout, so make sure it's an int

Ask Solem 13 سال پیش
والد
کامیت
dc7671f981
1فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 10 2
      celery/bin/celeryctl.py

+ 10 - 2
celery/bin/celeryctl.py

@@ -296,6 +296,7 @@ class inspect(Command):
         if not replies:
             raise Error("No nodes replied within time constraint.",
                         status=EX_UNAVAILABLE)
+        return replies
 
     def say(self, direction, title, body=""):
         c = self.colored
@@ -382,11 +383,18 @@ class celeryctl(CeleryCommand):
         return self.execute(command, argv)
 
 
+def determine_exit_status(ret):
+    if isinstance(ret, int):
+        return ret
+    return EX_OK if ret else W_FAILURE
+
+
 def main():
     try:
-        sys.exit(celeryctl().execute_from_commandline())
+        sys.exit(determine_exit_status(
+            celeryctl().execute_from_commandline()))
     except KeyboardInterrupt:
-        pass
+        sys.exit(EX_FAILURE)
 
 if __name__ == "__main__":          # pragma: no cover
     main()