lib.Result: Fill "cmd" ctor parameter

Commands executed by ExecContext and its derived classes don't
populate the "cmd" parameter of "Result"'s constructor. Fixing that
makes for nicer error messages.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-06-13 04:43:34 +02:00
commit 048726a1aa
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
5 changed files with 66 additions and 54 deletions

View file

@ -273,7 +273,7 @@ class AsyncSSH(Base):
)
stdout = b''.join(stdout_parts) if stdout_parts else None
return Result(stdout, None, exit_code)
return Result(stdout, None, exit_code, cmd = cmd)
finally:
if stdin_reader_installed:
@ -353,7 +353,7 @@ class AsyncSSH(Base):
exit_code = completed.returncode if completed.returncode is not None else -1
stdout = b''.join(stdout_parts) if stdout_parts else None
return Result(stdout, None, exit_code)
return Result(stdout, None, exit_code, cmd = cmd)
async def _run_ssh(
self,
@ -446,7 +446,7 @@ class AsyncSSH(Base):
completed.returncode if completed.returncode is not None else -1
)
return Result(stdout, stderr, exit_code)
return Result(stdout, stderr, exit_code, cmd = cmd)
except Exception as e:
log(ERR, f'Failed to run command {" ".join(cmd)} ({e})')