Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: longer timeout on Windows #974

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/scikit_build_core/program_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import json
import shutil
import subprocess
import sys
from pathlib import Path
from typing import TYPE_CHECKING, NamedTuple

Expand Down Expand Up @@ -32,6 +33,10 @@
return __all__


# Make sure we don't wait forever for programs to respond
TIMEOUT = 10 if sys.platform.startswith("win") else 4


class Program(NamedTuple):
path: Path
version: Version | None
Expand Down Expand Up @@ -80,7 +85,7 @@
None if it cannot be determined.
"""
try:
result = Run(timeout=2).capture(cmake_path, "-E", "capabilities")
result = Run(timeout=TIMEOUT).capture(cmake_path, "-E", "capabilities")
try:
version = Version(
json.loads(result.stdout)["version"]["string"].split("-")[0]
Expand All @@ -91,7 +96,7 @@
logger.warning("Could not determine CMake version, got {!r}", result.stdout)
except subprocess.CalledProcessError:
try:
result = Run(timeout=2).capture(cmake_path, "--version")
result = Run(timeout=TIMEOUT).capture(cmake_path, "--version")

Check warning on line 99 in src/scikit_build_core/program_search.py

View check run for this annotation

Codecov / codecov/patch

src/scikit_build_core/program_search.py#L99

Added line #L99 was not covered by tests
try:
version = Version(
result.stdout.splitlines()[0].split()[-1].split("-")[0]
Expand Down Expand Up @@ -135,7 +140,7 @@
"""
for ninja_path in _get_ninja_path(module=module):
try:
result = Run(timeout=2).capture(ninja_path, "--version")
result = Run(timeout=TIMEOUT).capture(ninja_path, "--version")
except (
subprocess.CalledProcessError,
PermissionError,
Expand Down
Loading