lib.ExecContext.run(), .sudo(): Rename env
The name of the env parameter to ExecContext.run() and .sudo() is not descriptive enough for which environment is supposed to be modified and how, so rename and split it up as follows:
- .run(): env -> mod_env
- .sudo(): env -> mod_env_sudo and mod_env_cmd
The parameters have the following meaning:
- "mod_env*" means that the environment is modified, not replaced
- "mod_env" and "mod_env_cmd" modify the environment "cmd" runs in
- "mod_env_sudo" modifies the environment sudo runs in
Fix the fallout of the API change all over jw-pkg.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
9f756222fe
commit
54aecff8e4
9 changed files with 164 additions and 159 deletions
|
|
@ -17,7 +17,7 @@ class Exec(Base):
|
|||
self.__askpass_orig: dict[str, str|None] = dict()
|
||||
super().__init__(
|
||||
uri = uri,
|
||||
caps = self.Caps.Env,
|
||||
caps = self.Caps.ModEnv,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ class Exec(Base):
|
|||
wd: str|None,
|
||||
verbose: bool,
|
||||
cmd_input: bytes|None,
|
||||
env: dict[str, str]|None,
|
||||
mod_env: dict[str, str]|None,
|
||||
interactive: bool,
|
||||
log_prefix: str
|
||||
) -> Result:
|
||||
|
|
@ -57,8 +57,8 @@ class Exec(Base):
|
|||
if cmd_input is None:
|
||||
cmd_input = InputMode.Interactive if interactive else InputMode.NonInteractive
|
||||
opts: dict[str, str] = []
|
||||
if env:
|
||||
for key, val in env.items():
|
||||
if mod_env:
|
||||
for key, val in mod_env.items():
|
||||
opts.extend(['-o', f'SetEnv {key}="{val}"'])
|
||||
if self.username:
|
||||
opts.extend(['-l', self.username])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue