Skip to content

Commit ff66dad

Browse files
committed
Start Podman or Docker automatically.
1 parent a95bf9a commit ff66dad

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

doc_builder/build_docs.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,20 @@ def run_build_command(build_command, version, options):
229229
)
230230

231231
print(" ".join(build_command))
232-
subprocess.check_call(build_command, env=env)
232+
try:
233+
subprocess.run(build_command, env=env, capture_output=True, check=True, text=True)
234+
except subprocess.CalledProcessError as exc:
235+
if "Cannot connect to Podman" in exc.stderr:
236+
print("Starting Podman machine...")
237+
subprocess.check_call("podman machine start", shell=True, stdout=subprocess.DEVNULL)
238+
subprocess.check_call(build_command, env=env)
239+
elif "Cannot connect to the Docker daemon" in exc.stderr:
240+
print("Starting Docker...")
241+
subprocess.check_call("docker desktop start", shell=True, stdout=subprocess.DEVNULL)
242+
subprocess.check_call(build_command, env=env)
243+
else:
244+
print("\n".join([exc.stdout, exc.stderr]))
245+
raise exc
233246

234247

235248
def setup_for_container():

0 commit comments

Comments
 (0)