You've already forked code_examples_server
mirror of
https://github.com/AdaCore/code_examples_server.git
synced 2026-02-12 12:45:18 -08:00
Run the program in the container under a timeout
Another level of defense against DDOS.
This commit is contained in:
@@ -42,7 +42,8 @@ def safe_run(main):
|
||||
# Run it, printint output to stdout as we go along
|
||||
subprocess.call(["lxc", "exec", CONT, "--",
|
||||
"su", "ubuntu", "-c",
|
||||
os.path.join(tmpdir, os.path.basename(main))],
|
||||
"timeout 20s {}".format(
|
||||
os.path.join(tmpdir, os.path.basename(main)))],
|
||||
stdout=sys.stdout)
|
||||
except E:
|
||||
print sys.exc_info()
|
||||
|
||||
Reference in New Issue
Block a user