bugfix for module_cmd (#5038)

* bugfix for modulecmd when bash is symlinked to sh

* update test to make sure module_cmd can interpret sh
This commit is contained in:
becker33 2017-08-09 12:14:35 -07:00 committed by GitHub
parent faeb1b77b2
commit 79f9548a9a
2 changed files with 2 additions and 2 deletions

View File

@ -112,7 +112,7 @@ def test_get_module_cmd_from_bash_ticks(save_env):
def test_get_module_cmd_from_bash_parens(save_env): def test_get_module_cmd_from_bash_parens(save_env):
os.environ['BASH_FUNC_module()'] = '() { eval $(echo fill bash $*)\n}' os.environ['BASH_FUNC_module()'] = '() { eval $(echo fill sh $*)\n}'
module_cmd = get_module_cmd() module_cmd = get_module_cmd()
module_cmd_list = module_cmd('list', output=str, error=str) module_cmd_list = module_cmd('list', output=str, error=str)

View File

@ -97,7 +97,7 @@ def get_module_cmd_from_bash(bashopts=''):
module_cmd = which(args[0]) module_cmd = which(args[0])
if module_cmd: if module_cmd:
for arg in args[1:]: for arg in args[1:]:
if arg == 'bash': if arg in ('bash', 'sh'):
module_cmd.add_default_arg('python') module_cmd.add_default_arg('python')
break break
else: else: