Skip to content
Open
Show file tree
Hide file tree
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
37 changes: 25 additions & 12 deletions src/specify_cli/integrations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,18 +407,31 @@ def dispatch_command(
"stderr": "",
}

result = subprocess.run(
exec_args,
capture_output=True,
text=True,
cwd=cwd,
timeout=timeout,
)
return {
"exit_code": result.returncode,
"stdout": result.stdout,
"stderr": result.stderr,
}
try:
result = subprocess.run(
exec_args,
capture_output=True,
text=True,
cwd=cwd,
timeout=timeout,
)
return {
"exit_code": result.returncode,
"stdout": result.stdout,
"stderr": result.stderr,
}
except subprocess.TimeoutExpired:
return {
"exit_code": 124,
"stdout": "",
"stderr": f"Command timed out after {timeout}s",
}
except OSError as exc:
return {
"exit_code": 1,
"stdout": "",
"stderr": f"Failed to execute command: {exc}",
}

# -- Primitives — building blocks for setup() -------------------------

Expand Down
37 changes: 25 additions & 12 deletions src/specify_cli/integrations/copilot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,31 @@ def dispatch_command(
"stderr": "",
}

result = subprocess.run(
cli_args,
capture_output=True,
text=True,
cwd=cwd,
timeout=timeout,
)
return {
"exit_code": result.returncode,
"stdout": result.stdout,
"stderr": result.stderr,
}
try:
result = subprocess.run(
cli_args,
capture_output=True,
text=True,
cwd=cwd,
timeout=timeout,
)
return {
"exit_code": result.returncode,
"stdout": result.stdout,
"stderr": result.stderr,
}
except subprocess.TimeoutExpired:
return {
"exit_code": 124,
"stdout": "",
"stderr": f"Command timed out after {timeout}s",
}
except OSError as exc:
return {
"exit_code": 1,
"stdout": "",
"stderr": f"Failed to execute command: {exc}",
}

def command_filename(self, template_name: str) -> str:
"""Copilot commands use ``.agent.md`` extension."""
Expand Down