Explicit return value from main

Rather than sometimes returning an integer, sometimes a boolean and
sometimes implicitly returning None, always return 0 for success and 1
for failure.

No behavior change for the program as a whole, since the None/True/False
values were implicitly converted to the desired numerical value.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2020-03-24 15:43:49 +01:00
parent ce674a90c5
commit e22a4dacf7

View File

@ -452,7 +452,7 @@ if __name__ == '__main__':
value = config[args.symbol]
if value:
sys.stdout.write(value + '\n')
return args.symbol not in config
return 0 if args.symbol in config else 1
elif args.command == 'set':
if not args.force and args.symbol not in config.settings:
sys.stderr.write("A #define for the symbol {} "
@ -465,6 +465,7 @@ if __name__ == '__main__':
else:
config.adapt(args.adapter)
config.write(args.write)
return 0
# Import modules only used by main only if main is defined and called.
# pylint: disable=wrong-import-position