diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-10-19 19:41:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 13:41:25 +0200 |
commit | f5c23f8058ed7ce85846c6b1e623329a09fa1a76 (patch) | |
tree | 665ecf11b2f339f0151f187867cc6249e68b94b8 /cli/repl.rs | |
parent | d3dea24560f7434bd1020f0d9dc4c787f79479da (diff) |
fix(cli/repl): write all results to stdout (#7893)
This writes all evaluaton results to stdout regardless if the result is
an error or not.
This matches the behavior of other read-eval-print-loops like Node.
Diffstat (limited to 'cli/repl.rs')
-rw-r--r-- | cli/repl.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/cli/repl.rs b/cli/repl.rs index 2e41b0565..be887e941 100644 --- a/cli/repl.rs +++ b/cli/repl.rs @@ -391,16 +391,13 @@ pub async fn run( let inspect_result = inspect_response.get("result").unwrap(); - match evaluate_exception_details { - Some(_) => eprintln!( - "Uncaught {}", - inspect_result.get("value").unwrap().as_str().unwrap() - ), - None => println!( - "{}", - inspect_result.get("value").unwrap().as_str().unwrap() - ), - } + let value = inspect_result.get("value").unwrap().as_str().unwrap(); + let output = match evaluate_exception_details { + Some(_) => format!("Uncaught {}", value), + None => value.to_string(), + }; + + println!("{}", output); editor.lock().unwrap().add_history_entry(line.as_str()); } |