From 828879dd9bc1a6e4db8dcdd5473b6146cd03ef99 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 5 Mar 2011 11:27:48 +0100 Subject: [PATCH] [entropy.const] add support to ETP_NO_PID_HANDLING (which is the same of --no-pid-handling argv) --- libraries/entropy/const.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/entropy/const.py b/libraries/entropy/const.py index de6b9d529..f46ac9b87 100644 --- a/libraries/entropy/const.py +++ b/libraries/entropy/const.py @@ -784,7 +784,8 @@ def const_setup_entropy_pid(just_read = False, force_handling = False): """ Setup Entropy pid file, if possible and if UID = 0 (root). - If the application is run with --no-pid-handling argument, + If the application is run with --no-pid-handling argument + (or ETP_NO_PID_HANDLING env var is set), this function will have no effect. If just_read is specified, this function will only try to read the current pid string in the Entropy pid file (etpConst['pidfile']). If any other entropy @@ -800,9 +801,10 @@ def const_setup_entropy_pid(just_read = False, force_handling = False): @return: tuple composed by two bools, (if pid lock file has been acquired, locked resources) """ + no_pid_handling = ("--no-pid-handling" in sys.argv) or \ + os.getenv("ETP_NO_PID_HANDLING") - if (("--no-pid-handling" in sys.argv) and not force_handling) \ - and not just_read: + if (no_pid_handling and not force_handling) and not just_read: return False, False setup_done = False