fix(server): run on non-Windows python (#94)

This commit is contained in:
Pierre Carrier
2024-11-06 08:18:13 +01:00
committed by GitHub
parent 3c458c63de
commit 1754f195b0

View File

@@ -88,8 +88,19 @@ def execute_command():
# Execute the command without any safety checks.
try:
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell, text=True,
timeout=120, creationflags=subprocess.CREATE_NO_WINDOW)
if platform_name == "Windows":
flags = subprocess.CREATE_NO_WINDOW
else:
flags = 0
result = subprocess.run(
command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=shell,
text=True,
timeout=120,
creationflags=flags,
)
return jsonify({
'status': 'success',
'output': result.stdout,