Update shell_execution_engine.py

This commit is contained in:
Saifeddine ALOUI
2024-03-08 15:00:00 +01:00
committed by GitHub
parent d5fed9d6db
commit daece07885

View File

@ -50,11 +50,11 @@ def execute_bash(code, client:Client):
# Check if the process was successful.
if process.returncode != 0:
# The child process threw an exception.
error_message = f"Error executing Python code: {error.decode('utf8')}"
error_message = f"Error executing Python code: {error.decode('utf8','ignore')}"
error_json = {"output": "<div class='text-red-500'>"+error_message+"</div>", "execution_time": execution_time}
return error_json
# The child process was successful.
output_json = {"output": output.decode("utf8"), "execution_time": execution_time}
return output_json
return spawn_process(code)
return spawn_process(code)