()
| 79 | handler = handlers[username] |
| 80 | # start process in background |
| 81 | async def stream_response(): |
| 82 | asyncio.create_task(handler.run(command, user_workspace)) # start the process as a task |
| 83 | async for output in handler.get_stream(): |
| 84 | if isinstance(output, dict): |
| 85 | yield f"data: {output}\n\n" # Send final status |
| 86 | break |
| 87 | yield f"data: {output}\n\n" |
| 88 | |
| 89 | return StreamingResponse(stream_response(), media_type="text/event-stream") |
| 90 |
no test coverage detected