fix :__main__ not working within interpreter

This commit is contained in:
martin legrand 2025-04-15 20:56:58 +02:00
parent e1d55649d5
commit 6d1edf9184
4 changed files with 12 additions and 2 deletions

View File

@ -14,6 +14,7 @@ function App() {
useEffect(() => { useEffect(() => {
scrollToBottom(); scrollToBottom();
checkHealth();
}, [messages]); }, [messages]);
// Added: checks /health // Added: checks /health

7
sources/tmp.py Normal file
View File

@ -0,0 +1,7 @@
def print_hello():
hello = "Hello World"
print(hello)
if __name__ == "__main__":
print_hello()

View File

@ -30,6 +30,7 @@ class PyInterpreter(Tools):
'__builtins__': __builtins__, '__builtins__': __builtins__,
'os': os, 'os': os,
'sys': sys, 'sys': sys,
'__name__': '__main__'
} }
code = '\n\n'.join(codes) code = '\n\n'.join(codes)
try: try:
@ -93,6 +94,9 @@ here is a save test
def print_hello(): def print_hello():
hello = "Hello World" hello = "Hello World"
print(hello) print(hello)
if __name__ == "__main__":
print_hello()
``` ```
""" """
py = PyInterpreter() py = PyInterpreter()

View File

@ -54,8 +54,6 @@ if [ ! -f "docker-compose.yml" ]; then
exit 1 exit 1
fi fi
echo "SearXNG setup complete!"
# start docker compose for searxng, redis, frontend services # start docker compose for searxng, redis, frontend services
echo "Warning: stopping all docker containers (t-4 seconds)..." echo "Warning: stopping all docker containers (t-4 seconds)..."
sleep 4 sleep 4