diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-07-15 22:08:21 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-07-15 22:08:21 -0700 |
commit | 2c3afb53dda7c83c70be4c12bd76930fe568b860 (patch) | |
tree | 4d326dae46e980614b29231c976aaf8099c565c6 /081run_interactive.cc | |
parent | 38a8e1c9cf8a7a8b5f88c63e0a429c8dee2fe4e3 (diff) | |
download | mu-2c3afb53dda7c83c70be4c12bd76930fe568b860.tar.gz |
1793 - rudimentary sandboxing for scenarios in the environment
Diffstat (limited to '081run_interactive.cc')
-rw-r--r-- | 081run_interactive.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/081run_interactive.cc b/081run_interactive.cc index ab13291d..1d317d4b 100644 --- a/081run_interactive.cc +++ b/081run_interactive.cc @@ -43,11 +43,20 @@ bool Running_interactive = false; :(before "End Setup") Running_interactive = false; :(code) -// reads a string, tries to call it as code, saving all warnings. +// reads a string, tries to call it as code (treating it as a test), saving +// all warnings. // returns true if successfully called (no errors found during load and transform) bool run_interactive(long long int address) { if (Recipe_ordinal.find("interactive") == Recipe_ordinal.end()) Recipe_ordinal["interactive"] = Next_recipe_ordinal++; + // try to sandbox the run as best you can + // todo: test this + if (!Current_scenario) { + // not already sandboxed + for (long long int i = 1; i < Reserved_for_tests; ++i) + Memory.erase(i); + Name[Recipe_ordinal["interactive"]].clear(); + } string command = trim(strip_comments(to_string(address))); if (command.empty()) return false; Recipe.erase(Recipe_ordinal["interactive"]); |