diff options
author | André Erdmann <dywi@mailerd.de> | 2014-12-16 01:17:10 +0100 |
---|---|---|
committer | André Erdmann <dywi@mailerd.de> | 2014-12-16 01:17:10 +0100 |
commit | 60f3c871f6320e3b637d61f319c5960824567c82 (patch) | |
tree | bee83692200557dc3aa738d0cfc65a1f22ba9bc2 | |
parent | run commands without stdin by default (diff) | |
download | R_overlay-60f3c871f6320e3b637d61f319c5960824567c82.tar.gz R_overlay-60f3c871f6320e3b637d61f319c5960824567c82.tar.bz2 R_overlay-60f3c871f6320e3b637d61f319c5960824567c82.zip |
run non-user hooks with /dev/null as stdin
-rw-r--r-- | roverlay/tools/shenv.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/roverlay/tools/shenv.py b/roverlay/tools/shenv.py index 8f2cea2..5670354 100644 --- a/roverlay/tools/shenv.py +++ b/roverlay/tools/shenv.py @@ -29,6 +29,8 @@ LOGGER = logging.getLogger ( 'shenv' ) NULL_PHASE = 'null' +SHENV_PHASES_WITH_STDIN = frozenset ({ 'user', }) + SHENV_VARS_TO_KEEP = frozenset ({ ( 'PATH', '/usr/local/bin:/usr/bin:/bin' ), 'PWD', @@ -348,7 +350,7 @@ def run_script_exec ( def run_script ( script, phase, argv=(), return_success=False, logger=None, - log_output=True, initial_dir=None, allow_stdin=True + log_output=True, initial_dir=None ): # global _SHELL_INTPR # if _SHELL_INTPR is None: @@ -360,7 +362,11 @@ def run_script ( script_call, output = _run_subprocess ( # ( _SHELL_INTPR, script, ), ( script, ) + argv, - stdin = None if allow_stdin else False, + stdin = ( + None if ( + my_env ['ROVERLAY_PHASE'] in SHENV_PHASES_WITH_STDIN + ) else False + ), stdout = subprocess.PIPE if log_output else None, stderr = subprocess.PIPE if log_output else None, cwd = my_env ['S'] if initial_dir is None else initial_dir, |