MCPcopy Create free account
hub / github.com/Roy3838/Observer / _run

Function _run

api/messaging.py:291–313  ·  view source on GitHub ↗

Run a command without blocking the event loop. Returns (returncode, stdout, stderr). Raises asyncio.TimeoutError after `timeout` seconds and FileNotFoundError if the binary is missing, like subprocess.run did. The child is killed on timeout or cancellation, so an abandoned request

(cmd: list[str], timeout: float)

Source from the content-addressed store, hash-verified

289
290
291async def _run(cmd: list[str], timeout: float) -> tuple[int, str, str]:
292 """
293 Run a command without blocking the event loop. Returns (returncode,
294 stdout, stderr). Raises asyncio.TimeoutError after `timeout` seconds and
295 FileNotFoundError if the binary is missing, like subprocess.run did.
296
297 The child is killed on timeout or cancellation, so an abandoned request
298 never leaves an ffmpeg process running.
299 """
300 proc = await asyncio.create_subprocess_exec(
301 *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
302 )
303 try:
304 stdout, stderr = await asyncio.wait_for(proc.communicate(), timeout)
305 except (asyncio.TimeoutError, asyncio.CancelledError):
306 proc.kill()
307 await proc.wait()
308 raise
309 return (
310 proc.returncode,
311 stdout.decode(errors="replace"),
312 stderr.decode(errors="replace"),
313 )
314
315
316def _write_file(path: Path, video_b64: str, max_size_mb: float) -> None:

Callers 1

_save_temp_videoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected