util.close_stdin(): Use the common 'is_false' routine for testing false

instead of a custom list that may confuse people trying to use this, use the
is_false function.
This commit is contained in:
Scott Moser 2012-07-10 14:29:24 -04:00
commit 8ae513e2a9

View File

@ -828,7 +828,7 @@ def close_stdin():
if _CLOUD_INIT_SAVE_STDIN is set in environment to a non empty or '0' value
then input will not be closed (only useful potentially for debugging).
"""
if os.environ.get("_CLOUD_INIT_SAVE_STDIN") in ("", "0", 'False'):
if is_false(os.environ.get("_CLOUD_INIT_SAVE_STDIN")):
return
with open(os.devnull) as fp:
os.dup2(fp.fileno(), sys.stdin.fileno())