pw_{cli,module,watch}: Add exit codes
Add explicit exit codes to entry points in these modules.
Change-Id: I6fba1d1251d6a36245b0f15d10c422436362a44e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/192897
Reviewed-by: Erik Gilling <konkers@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
diff --git a/pw_cli/py/pw_cli/log.py b/pw_cli/py/pw_cli/log.py
index e1ef13f..37877e6 100644
--- a/pw_cli/py/pw_cli/log.py
+++ b/pw_cli/py/pw_cli/log.py
@@ -58,7 +58,7 @@
return c_level * 10
-def main() -> None:
+def main() -> int:
"""Shows how logs look at various levels."""
# Force the log level to make sure all logs are shown.
@@ -73,6 +73,8 @@
_LOG.log(LOGLEVEL_STDOUT, 'Standard output of subprocess')
_LOG.debug('Adding 1 to i')
+ return 0
+
def _setup_handler(
handler: logging.Handler,
diff --git a/pw_module/py/pw_module/__main__.py b/pw_module/py/pw_module/__main__.py
index 5fd3a26..0f85d34 100644
--- a/pw_module/py/pw_module/__main__.py
+++ b/pw_module/py/pw_module/__main__.py
@@ -19,7 +19,7 @@
import pw_module.create
-def main() -> None:
+def main() -> int:
"""Entrypoint for the `pw module` plugin."""
parser = argparse.ArgumentParser(description=__doc__)
@@ -39,6 +39,8 @@
del args['func']
func(**args)
+ return 0
+
if __name__ == '__main__':
main()
diff --git a/pw_watch/py/pw_watch/watch.py b/pw_watch/py/pw_watch/watch.py
index fcecd4a..015fc05 100755
--- a/pw_watch/py/pw_watch/watch.py
+++ b/pw_watch/py/pw_watch/watch.py
@@ -955,7 +955,7 @@
return parser
-def main() -> None:
+def main() -> int:
"""Watch files for changes and rebuild."""
parser = get_parser()
args = parser.parse_args()
@@ -1001,6 +1001,8 @@
fullscreen=args.fullscreen,
)
+ return 0
+
if __name__ == '__main__':
main()