Skip to content

Commit

Permalink
Merge pull request #946 from RonnyPfannschmidt/ronny/fix-943-timeouts…
Browse files Browse the repository at this point in the history
…-on-github

fix #943: extend default timeout to account for github ci issues
  • Loading branch information
RonnyPfannschmidt authored Sep 30, 2023
2 parents 6a7ad1c + e39b9fe commit dc96f83
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/setuptools_scm/_run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import textwrap
import warnings
from typing import Callable
from typing import Final
from typing import Mapping
from typing import overload
from typing import Sequence
Expand All @@ -20,6 +21,11 @@
else:
BaseCompletedProcess = subprocess.CompletedProcess

# pick 40 seconds
# unfortunately github CI for windows sometimes needs
# up to 30 seconds to start a command

BROKEN_TIMEOUT: Final[int] = 40

log = _log.log.getChild("run_cmd")

Expand Down Expand Up @@ -126,7 +132,7 @@ def run(
*,
strip: bool = True,
trace: bool = True,
timeout: int = 20,
timeout: int = BROKEN_TIMEOUT,
check: bool = False,
) -> CompletedProcess:
if isinstance(cmd, str):
Expand Down Expand Up @@ -174,7 +180,7 @@ def has_command(
name: str, args: Sequence[str] = ["version"], warn: bool = True
) -> bool:
try:
p = run([name, *args], cwd=".", timeout=5)
p = run([name, *args], cwd=".", timeout=BROKEN_TIMEOUT)
if p.returncode != 0:
log.error(f"Command '{name}' returned non-zero. This is stderr:")
log.error(p.stderr)
Expand Down

0 comments on commit dc96f83

Please sign in to comment.