lib.ExecContext.sudo(): Default None mod_env to {}

mod_env can be None. Make it an empty dict in that case to take a
little burden off the implementations in the derived classes.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-03-21 10:41:21 +01:00
commit 3bda9bc826

View file

@ -202,6 +202,8 @@ class ExecContext(abc.ABC):
ret = Result(None, None, 1) ret = Result(None, None, 1)
if opts is None: if opts is None:
opts = {} opts = {}
if mod_env is None:
mod_env = {}
with self.CallContext(self, title=title, cmd=cmd, cmd_input=cmd_input, wd=wd, with self.CallContext(self, title=title, cmd=cmd, cmd_input=cmd_input, wd=wd,
log_prefix='|', interactive=None, throw=throw, verbose=verbose) as cc: log_prefix='|', interactive=None, throw=throw, verbose=verbose) as cc:
try: try: