feat(foreign): support raw stdin and per-cell inputs
Session eval now carries raw stdin, and the Python/Node workers temporarily replace program stdin during evaluation. foreign.session accepts an inputs table; view exposes per-cell stdin and Run All sends a per-cell input map. Stateless and persistent cells share the same input semantics.
This commit is contained in:
1 parent
a7266185b2
commit
c85f1a2829
8 files changed
+303
-19
No files matched your search
@@ -204,7 +204,12 @@ pub fn api_run_all(root: &Path, body: &str) -> serde_json::Value {
|
||||
let v = body_value(body);
|
||||
let restart = v.get("restart").and_then(|x| x.as_bool()).unwrap_or(false);
|
||||
let stdin = v.get("stdin").and_then(|x| x.as_str());
|
||||
with_session(root, body, "summary", |s| s.run_all_with_stdin(restart, stdin))
|
||||
let inputs: Option<HashMap<String, String>> = v.get("inputs").and_then(|x| x.as_object()).map(|m| {
|
||||
m.iter()
|
||||
.filter_map(|(k, val)| val.as_str().map(|s| (k.clone(), s.to_string())))
|
||||
.collect()
|
||||
});
|
||||
with_session(root, body, "summary", |s| s.run_all_with_inputs(restart, stdin, inputs.as_ref()))
|
||||
}
|
||||
|
||||
pub fn api_kernel_restart(root: &Path, body: &str) -> serde_json::Value {
|
||||
|
||||
Reference in new issue
Block a user