Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions secator/runners/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,8 @@ def yielder(self):
self.print_command()

# Check for sudo requirements and prepare the password if needed
sudo_required = re.search(r'\bsudo\b', self.cmd)
sudo_password = None
if CONFIG.security.prompt_sudo_password and sudo_required:
if CONFIG.security.prompt_sudo_password and self.requires_sudo:
self.debug('prompting for sudo password', sub='start')
sudo_password, error = self._prompt_sudo(self.cmd)
if error:
Expand Down Expand Up @@ -544,7 +543,7 @@ def yielder(self):
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
preexec_fn=os.setsid if not (sudo_required or self.disable_preexec) else None,
preexec_fn=os.setsid if not (self.requires_sudo or self.disable_preexec) else None,
shell=self.shell,
errors='replace',
env=env,
Expand Down
Loading