Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ async def wirte_file(websocket, project_name, path, content):
|
|
40 |
await websocket.send(f"Error: {str(e)}")
|
41 |
|
42 |
|
43 |
-
async def execute_command(websocket, project_name, command):
|
44 |
base_path = os.path.join(os.getcwd(), 'projects', project_name)
|
45 |
|
46 |
try:
|
@@ -55,7 +55,8 @@ async def execute_command(websocket, project_name, command):
|
|
55 |
|
56 |
async def send_message(message):
|
57 |
print('sending msg')
|
58 |
-
await websocket.send(f'data: {message}')
|
|
|
59 |
|
60 |
async for line in process.stdout:
|
61 |
print('sending line')
|
@@ -181,7 +182,7 @@ async def exe(websocket,connected):
|
|
181 |
|
182 |
try:
|
183 |
if "command" in event:
|
184 |
-
await execute_command(websocket, event["project_name"], event["command"])
|
185 |
elif "write" in event:
|
186 |
|
187 |
await wirte_file(websocket, event["project_name"], event["path"], event["content"])
|
|
|
40 |
await websocket.send(f"Error: {str(e)}")
|
41 |
|
42 |
|
43 |
+
async def execute_command(websocket, project_name, command, connected):
|
44 |
base_path = os.path.join(os.getcwd(), 'projects', project_name)
|
45 |
|
46 |
try:
|
|
|
55 |
|
56 |
async def send_message(message):
|
57 |
print('sending msg')
|
58 |
+
# await websocket.send(f'data: {message}')
|
59 |
+
websockets.broadcast(connected,f'data: {message}' )
|
60 |
|
61 |
async for line in process.stdout:
|
62 |
print('sending line')
|
|
|
182 |
|
183 |
try:
|
184 |
if "command" in event:
|
185 |
+
await execute_command(websocket, event["project_name"], event["command"], connected)
|
186 |
elif "write" in event:
|
187 |
|
188 |
await wirte_file(websocket, event["project_name"], event["path"], event["content"])
|