diff options
-rw-r--r-- | executor.py | 12 | ||||
-rw-r--r-- | snekbox.py | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/executor.py b/executor.py new file mode 100644 index 0000000..713412b --- /dev/null +++ b/executor.py @@ -0,0 +1,12 @@ +import sys +import ast + + +def main(): + code = sys.argv[1] + tree = ast.parse(code) + fake_interactive_tree = ast.Interactive() + fake_interactive_tree.body = tree.body + exec(compile(fake_interactive_tree, "<input>", "single"), {}, {}) + +main()
\ No newline at end of file @@ -44,7 +44,7 @@ class Snekbox(object): '--cgroup_pids_max=1', '--cgroup_mem_max=52428800', '--quiet', '--', - self.python_binary, '-ISq', '-c', cmd] + self.python_binary, '-ISq', '/snekbox/executor.py', cmd] try: proc = subprocess.Popen(args, stdin=subprocess.PIPE, |