Skip to content
Dashboard

Execute command (synchronous)

computers.exec.sync(strid, ExecSyncParams**kwargs) -> ExecSyncResponse
POST/computers/{id}/exec/sync

Execute a shell command and wait for completion, returning buffered stdout/stderr.

ParametersExpand Collapse
id: str
command: Optional[str]
cwd: Optional[str]
env: Optional[Dict[str, str]]
timeout_seconds: Optional[int]
ReturnsExpand Collapse
class ExecSyncResponse:
exit_code: Optional[int]
stderr: Optional[str]
stdout: Optional[str]

Execute command (synchronous)

import os
from tzafon import Lightcone

client = Lightcone(
    api_key=os.environ.get("TZAFON_API_KEY"),  # This is the default and can be omitted
)
response = client.computers.exec.sync(
    id="id",
)
print(response.exit_code)
{
  "exit_code": 0,
  "stderr": "stderr",
  "stdout": "stdout"
}
Returns Examples
{
  "exit_code": 0,
  "stderr": "stderr",
  "stdout": "stdout"
}