aboutsummaryrefslogtreecommitdiffstats
path: root/executor.py
diff options
context:
space:
mode:
authorGravatar hargoniX <[email protected]>2018-12-29 16:07:48 +0100
committerGravatar hargoniX <[email protected]>2018-12-29 16:07:48 +0100
commit4347dab4cd9fd285423e3b6b5959c905599b79a3 (patch)
tree4c300976db39ebe29cad8e79c1e3ac3f32538fe1 /executor.py
parentUpgrades Pipfile.lock to use requests 2.20.1, fixes CVE-2018-18074 (#2) (diff)
implementing repl like evaluation, the code doesnt work inside docker yet because its excluding parts of the stdlib from the venv for some reasonrepl-like
Diffstat (limited to 'executor.py')
-rw-r--r--executor.py12
1 files changed, 12 insertions, 0 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