Skip to content

Commit

Permalink
Specify whether sudo env forwarding is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemartinlogan committed Sep 19, 2023
1 parent 3e7b2c4 commit 7bae948
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions jarvis_util/shell/exec_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,12 @@ def smash_cmd(self, cmds, sudo, basic_env, sudoenv):
:return:
"""
env = None
if sudo and sudoenv:
env = [f'-E {key}=\"{val}\"' for key, val in
basic_env.items()]
env = ' '.join(env)
if sudo:
env = ''
if sudoenv:
env = [f'-E {key}=\"{val}\"' for key, val in
basic_env.items()]
env = ' '.join(env)
env = f'sudo {env}'
if not isinstance(cmds, (list, tuple)):
cmds = [cmds]
Expand Down

0 comments on commit 7bae948

Please sign in to comment.