MCPcopy Create free account
hub / github.com/FastLED/FastLED / _run_zccache

Function _run_zccache

ci/fingerprint/core.py:344–387  ·  view source on GitHub ↗

Run a zccache fingerprint CLI command. Tries the daemon-backed ``zccache fp`` first (<1ms on cache hit). Falls back to standalone ``zccache-fp`` if the daemon is unavailable. Args: args: Arguments after ``fp`` / the binary name. check: If True, raise on non-zero exit.

(
    args: list[str], *, check: bool = False, timeout: float = 60.0
)

Source from the content-addressed store, hash-verified

342
343
344def _run_zccache(
345 args: list[str], *, check: bool = False, timeout: float = 60.0
346) -> subprocess.CompletedProcess[str]:
347 """Run a zccache fingerprint CLI command.
348
349 Tries the daemon-backed ``zccache fp`` first (<1ms on cache hit).
350 Falls back to standalone ``zccache-fp`` if the daemon is unavailable.
351
352 Args:
353 args: Arguments after ``fp`` / the binary name.
354 check: If True, raise on non-zero exit.
355 timeout: Subprocess timeout in seconds.
356
357 Returns:
358 CompletedProcess with captured stdout/stderr.
359 """
360 # Try daemon-backed path first: ``zccache fp <args>``
361 zccache_bin = _find_zccache()
362 if zccache_bin:
363 cmd = [zccache_bin, "fp"] + args
364 result = subprocess.run(
365 cmd,
366 capture_output=True,
367 text=True,
368 check=False,
369 timeout=timeout,
370 )
371 # exit 0 (run) or 1 (skip) are valid; exit 2+ means daemon error
372 if result.returncode in (0, 1):
373 if check and result.returncode not in (0, 1):
374 raise subprocess.CalledProcessError(
375 result.returncode, cmd, result.stdout, result.stderr
376 )
377 return result
378
379 # Fallback to standalone: ``zccache-fp <args>``
380 cmd = [_find_zccache_fp()] + args
381 return subprocess.run(
382 cmd,
383 capture_output=True,
384 text=True,
385 check=check,
386 timeout=timeout,
387 )
388
389
390# ==============================================================================

Callers 8

check_needs_updateMethod · 0.85
mark_successMethod · 0.85
mark_failureMethod · 0.85
invalidateMethod · 0.85
check_needs_updateMethod · 0.85
mark_successMethod · 0.85
mark_failureMethod · 0.85
invalidateMethod · 0.85

Calls 3

_find_zccacheFunction · 0.85
_find_zccache_fpFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected