Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
|
@@ -160,7 +160,7 @@ async def exec_command(command):
|
|
| 160 |
async def send_prompt(websocket):
|
| 161 |
# Send initial prompt to client
|
| 162 |
prompt = await get_prompt()
|
| 163 |
-
await websocket.
|
| 164 |
|
| 165 |
@app.websocket("/shell")
|
| 166 |
async def websocket_endpoint(websocket: WebSocket):
|
|
@@ -173,14 +173,14 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
| 173 |
command = await websocket.receive_text()
|
| 174 |
|
| 175 |
if command == "exit":
|
| 176 |
-
await websocket.
|
| 177 |
break
|
| 178 |
|
| 179 |
# Execute command
|
| 180 |
output = await exec_command(command)
|
| 181 |
|
| 182 |
# Send output to client
|
| 183 |
-
await websocket.
|
| 184 |
|
| 185 |
# Send updated prompt to client
|
| 186 |
await send_prompt(websocket)
|
|
|
|
| 160 |
async def send_prompt(websocket):
|
| 161 |
# Send initial prompt to client
|
| 162 |
prompt = await get_prompt()
|
| 163 |
+
await websocket.send_text(prompt)
|
| 164 |
|
| 165 |
@app.websocket("/shell")
|
| 166 |
async def websocket_endpoint(websocket: WebSocket):
|
|
|
|
| 173 |
command = await websocket.receive_text()
|
| 174 |
|
| 175 |
if command == "exit":
|
| 176 |
+
await websocket.send_text("Goodbye!")
|
| 177 |
break
|
| 178 |
|
| 179 |
# Execute command
|
| 180 |
output = await exec_command(command)
|
| 181 |
|
| 182 |
# Send output to client
|
| 183 |
+
await websocket.send_text(output)
|
| 184 |
|
| 185 |
# Send updated prompt to client
|
| 186 |
await send_prompt(websocket)
|