diff options
author | Oliver Smith <osmith@sysmocom.de> | 2018-11-08 13:39:03 +0100 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2018-11-12 11:01:46 +0100 |
commit | 10ffc822374c73d2204aff362cb8da20baab48ab (patch) | |
tree | ad87295b784e4002960bddf4220771a47292a8c1 /build/unix-time-to-fmt.py | |
parent | e65d9efb31b9dde36ebab3f7ab0dc49a028eaf37 (diff) |
unix-time-to-fmt.py: fix crash without argument
Print "unknown" to stdout when unix-time-to-fmt.py was called without
an argument, instead of printing a Python stack trace to stderr. It gets
called that way when building outside of a git folder.
Change-Id: I3ba27cc23543e47cc8a1e494c35cc33f1dc8f297
Diffstat (limited to 'build/unix-time-to-fmt.py')
-rwxr-xr-x | build/unix-time-to-fmt.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/build/unix-time-to-fmt.py b/build/unix-time-to-fmt.py index d081797..026e55c 100755 --- a/build/unix-time-to-fmt.py +++ b/build/unix-time-to-fmt.py @@ -11,6 +11,10 @@ Default is '%Y-%b-%d' --> 2016-Jan-01 import sys, time +if len(sys.argv) == 1: + print("unknown") + exit(0) + fmt = '%Y-%b-%d' if len(sys.argv) > 2: fmt = sys.argv[2] |