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

Class DockerManager

ci/docker_utils/DockerManager.py:31–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30
31class DockerManager:
32 def __init__(self):
33 # No direct client object, will use subprocess for docker CLI commands
34 pass
35
36 def _run_docker_command(
37 self,
38 command: list[str],
39 check: bool = True,
40 stream_output: bool = False,
41 timeout: Optional[int] = None,
42 interrupt_pattern: Optional[str] = None,
43 output_file: Optional[str] = None,
44 container_name: Optional[str] = None,
45 ) -> subprocess.CompletedProcess[str]:
46 docker_cmd = get_docker_command()
47 full_command = [docker_cmd] + command
48 print(f"Executing Docker command: {' '.join(full_command)}")
49
50 # Set environment to prevent MSYS2/Git Bash path conversion on Windows
51 env = os.environ.copy()
52 # Set UTF-8 encoding environment variables for Windows
53 env["PYTHONIOENCODING"] = "utf-8"
54 env["PYTHONUTF8"] = "1"
55 # Only set MSYS_NO_PATHCONV if we're in a Git Bash/MSYS2 environment
56 if (
57 "MSYSTEM" in os.environ
58 or os.environ.get("TERM") == "xterm"
59 or "bash.exe" in os.environ.get("SHELL", "")
60 ):
61 env["MSYS_NO_PATHCONV"] = "1"
62
63 if stream_output:
64 # Use RunningProcess for streaming output
65 import re
66 import time
67
68 from running_process import EndOfStream
69
70 proc = RunningProcess(full_command, env=env, auto_run=True)
71 timeout_occurred = False
72 start_time = time.time()
73
74 # Open output file if specified
75 output_handle = None
76 if output_file:
77 try:
78 output_handle = open(output_file, "w", encoding="utf-8")
79 except KeyboardInterrupt as ki:
80 handle_keyboard_interrupt(ki)
81 raise
82 except Exception as e:
83 print(f"Warning: Could not open output file {output_file}: {e}")
84
85 try:
86 # Use a reasonable line timeout (1 second) so we can check the overall timeout frequently
87 line_timeout = 1.0
88 while True:

Callers 2

__init__Method · 0.90
DockerManager.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected