about summary refs log tree commit diff stats
path: root/081run_interactive.cc
diff options
context:
space:
mode:
Diffstat (limited to '081run_interactive.cc')
-rw-r--r--081run_interactive.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/081run_interactive.cc b/081run_interactive.cc
index 67fba6e3..411b448a 100644
--- a/081run_interactive.cc
+++ b/081run_interactive.cc
@@ -303,9 +303,20 @@ long long int trace_contents(const string& layer) {
     out << p->contents;
     if (*--p->contents.end() != '\n') out << '\n';
   }
-  assert(!out.str().empty());
-//?   cerr << layer << ":\n" << out.str() << "\n--\n"; //? 1
-  return new_mu_string(out.str());
+  string result = out.str();
+  assert(!result.empty());
+//?   cerr << layer << ":\n" << result << "\n--\n"; //? 1
+  truncate(result);
+  return new_mu_string(result);
+}
+
+void truncate(string& x) {
+  if (SIZE(x) > 512) {
+    x.erase(512);
+    *x.rbegin() = '\n';
+    *++x.rbegin() = '.';
+    *++++x.rbegin() = '.';
+  }
 }
 
 //: simpler version of run-interactive: doesn't do any running, just loads