about summary refs log tree commit diff stats
path: root/081run_interactive.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-16 21:10:30 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-16 21:10:30 -0700
commitdf2c1409830d7fc5598f54fea0d728380851aa1c (patch)
treec00090256dd63b39129eb5fd222ec512f2005dbe /081run_interactive.cc
parent88e9989473226492f76cf5dc6b22eeb36fd97e49 (diff)
downloadmu-df2c1409830d7fc5598f54fea0d728380851aa1c.tar.gz
2024 - mu environment now handles infinite loops gracefully
Diffstat (limited to '081run_interactive.cc')
-rw-r--r--081run_interactive.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/081run_interactive.cc b/081run_interactive.cc
index b3746321..e290024d 100644
--- a/081run_interactive.cc
+++ b/081run_interactive.cc
@@ -37,11 +37,12 @@ case RUN_INTERACTIVE: {
   }
   bool new_code_pushed_to_stack = run_interactive(ingredients.at(0).at(0));
   if (!new_code_pushed_to_stack) {
-    products.resize(4);
+    products.resize(5);
     products.at(0).push_back(0);
     products.at(1).push_back(trace_contents("warn"));
     products.at(2).push_back(0);
     products.at(3).push_back(trace_contents("app"));
+    products.at(4).push_back(1);  // completed
     cleanup_run_interactive();
     break;  // done with this instruction
   }
@@ -103,12 +104,15 @@ load(string(
   "local-scope\n" +
   "screen:address/shared <- new-fake-screen 30, 5\n" +
   "r:number/routine_id <- start-running interactive:recipe, screen:address\n" +
+  "limit-time r, 750/instructions\n" +
   "wait-for-routine r\n" +
+  "sandbox-state:number <- routine-state r/routine_id\n" +
+  "completed?:boolean <- equal sandbox-state, 1/completed\n" +
   "output:address:array:character <- $most-recent-products\n" +
   "warnings:address:array:character <- save-trace [warn]\n" +
   "stashes:address:array:character <- save-trace [app]\n" +
   "$cleanup-run-interactive\n" +
-  "reply output, warnings, screen, stashes\n" +
+  "reply output, warnings, screen, stashes, completed?\n" +
 "]\n");
 transform_all();
 recently_added_recipes.clear();