Skip to content

Commit 484b3df

Browse files
ByronCopilot
andauthored
Use g for formatting floating point timeouts
The timeout error message formats `timeout` with `%d`, but `kill_after_timeout` is typed as `float` and is commonly passed as a non-integer (e.g., 0.1). This can produce a misleading message (truncation to 0) and may raise a formatting error depending on Python behavior. Format it as a float (or generic number) instead. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 59efde9 commit 484b3df

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

git/cmd.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,10 +1473,7 @@ def kill_process(pid: int) -> None:
14731473
return
14741474

14751475
def make_timeout_error() -> Union[str, bytes]:
1476-
err = 'Timeout: the command "%s" did not complete in %d secs.' % (
1477-
" ".join(redacted_command),
1478-
timeout,
1479-
)
1476+
err = f'Timeout: the command "{" ".join(redacted_command)}" did not complete in {timeout:g} secs.'
14801477
return err if universal_newlines else err.encode(defenc)
14811478

14821479
def communicate() -> Tuple[AnyStr, AnyStr]:

0 commit comments

Comments
 (0)