Skip to content

Commit 84d69c8

Browse files
committed
tmux_cmd(fix[logging]): standardize tmux_cmd extra on shlex.join
why: Pre-execution used shlex.join while error and post-execution used subprocess.list2cmdline, producing inconsistent formats for the same tmux_cmd extra key. list2cmdline uses Windows CMD quoting rules which are incorrect on Linux. what: - Replace subprocess.list2cmdline(cmd) with shlex.join(cmd) in error handler - Replace subprocess.list2cmdline(cmd) with shlex.join(cmd) in post-execution log - All three logging sites now use shlex.join consistently
1 parent b3e75d1 commit 84d69c8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/libtmux/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def __init__(self, *args: t.Any, tmux_bin: str | None = None) -> None:
284284
logger.error( # noqa: TRY400
285285
"tmux subprocess failed",
286286
extra={
287-
"tmux_cmd": subprocess.list2cmdline(cmd),
287+
"tmux_cmd": shlex.join(cmd),
288288
},
289289
)
290290
raise
@@ -308,7 +308,7 @@ def __init__(self, *args: t.Any, tmux_bin: str | None = None) -> None:
308308
logger.debug(
309309
"tmux command completed",
310310
extra={
311-
"tmux_cmd": subprocess.list2cmdline(cmd),
311+
"tmux_cmd": shlex.join(cmd),
312312
"tmux_exit_code": self.returncode,
313313
"tmux_stdout": self.stdout[:100],
314314
"tmux_stderr": self.stderr[:100],

0 commit comments

Comments
 (0)