Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -570,18 +570,17 @@ async def handle_user_input(websocket,key, process, connected):
|
|
570 |
def process_input(user_input, process):
|
571 |
if process:
|
572 |
try:
|
573 |
-
if user_input=='Ctrl+C':
|
574 |
-
print('process
|
|
|
575 |
process.send_signal(signal.SIGINT)
|
576 |
else:
|
577 |
process.stdin.write(user_input.encode('utf-8') + b'\n')
|
578 |
-
|
579 |
except Exception as e:
|
580 |
-
|
581 |
-
pass
|
582 |
else:
|
583 |
-
|
584 |
-
pass
|
585 |
|
586 |
async def create_file_structure(websocket, data, base_path='.'):
|
587 |
if data['type'] == 'folder':
|
|
|
570 |
def process_input(user_input, process):
|
571 |
if process:
|
572 |
try:
|
573 |
+
if user_input == 'Ctrl+C':
|
574 |
+
print('Stopping process')
|
575 |
+
# Send SIGINT signal to terminate the process gracefully
|
576 |
process.send_signal(signal.SIGINT)
|
577 |
else:
|
578 |
process.stdin.write(user_input.encode('utf-8') + b'\n')
|
579 |
+
process.stdin.flush()
|
580 |
except Exception as e:
|
581 |
+
print(f"Error writing to process stdin: {str(e)}")
|
|
|
582 |
else:
|
583 |
+
print("No process available to write to.")
|
|
|
584 |
|
585 |
async def create_file_structure(websocket, data, base_path='.'):
|
586 |
if data['type'] == 'folder':
|