Skip to content
Draft
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
16 changes: 16 additions & 0 deletions builder/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Some utils for builder."""

import inspect
import os
import subprocess
import sys
Expand Down Expand Up @@ -41,6 +42,21 @@ def run_command(
timeout: int | None = None,
) -> None:
"""Implement subprocess.run but handle timeout different."""
stack = inspect.stack()
print(
f"::group::"
f"{Path(*Path(stack[1].filename).parts[-2:])}:{stack[1].function}"
" => "
f"{Path(*Path(stack[0].filename).parts[-2:])}:{stack[0].function}"
"\n"
f"subprocess.run(\n"
f" cmd={cmd},\n"
f" env={'***' if env else env},\n"
f" timeout={timeout}\n"
Comment thread
eshattow marked this conversation as resolved.
f")\n"
f"::endgroup::\n",
)

subprocess.run( # noqa: S602
cmd,
shell=True,
Expand Down
Loading