aboutsummaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
authorDevin Jeanpierre <jeanpierreda@google.com>2020-09-25 11:17:28 -0700
committerCopybara-Service <copybara-worker@google.com>2020-09-25 11:17:54 -0700
commitdab1732ed9cfe85f97e940a24a4c3a5d52a530f7 (patch)
tree68e2966fe88f946b7acc4ae42215210dc490dd60 /absl
parent2da717de9f177031af24a52480f99c936023b216 (diff)
downloadabsl-py-dab1732ed9cfe85f97e940a24a4c3a5d52a530f7.tar.gz
Explicitly document that `app.run(main)` essentially does `sys.exit(main(...))`. This makes the behavior of `return "some string"` documented and supported.
I wasn't sure how much of the original wording to keep, but opted to change it as it seems misleading -- on my system, for example, `return 0` and `return 256` do the same thing (eeek). PiperOrigin-RevId: 333770740 Change-Id: Ifcac0a03793b1b3cf8818443ce8c4f86afe51a4b
Diffstat (limited to 'absl')
-rw-r--r--absl/app.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/absl/app.py b/absl/app.py
index 4cb37b3..6b5e91d 100644
--- a/absl/app.py
+++ b/absl/app.py
@@ -277,7 +277,10 @@ def run(
Args:
main: The main function to execute. It takes an single argument "argv",
which is a list of command line arguments with parsed flags removed.
- If it returns an integer, it is used as the process's exit code.
+ The return value is passed to `sys.exit`, and so for example
+ a return value of 0 or None results in a successful termination, whereas
+ a return value of 1 results in abnormal termination.
+ For more details, see https://docs.python.org/3/library/sys#sys.exit
argv: A non-empty list of the command line arguments including program name,
sys.argv is used if None.
flags_parser: Callable[[List[Text]], Any], the function used to parse flags.