aboutsummaryrefslogtreecommitdiffstats
path: root/src/run
diff options
context:
space:
mode:
Diffstat (limited to 'src/run')
-rw-r--r--src/run/mod.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/run/mod.rs b/src/run/mod.rs
index 6fe0d45..8a728c5 100644
--- a/src/run/mod.rs
+++ b/src/run/mod.rs
@@ -482,13 +482,21 @@ pub fn run(se: Arc<Mutex<Session>>, parsed: Ast<PreExpansion>) {
let result = exec(se.clone(), parsed);
se.lock().unwrap().raw.enable();
- let status_string = match result {
- Ok(_) => String::new(),
- Err(e) => format!("{}\r\n", e.error_message()),
- };
+ if se.lock().unwrap().loud {
+ let status_string = match result {
+ Ok(_) => String::new(),
+ Err(e) => format!("{}\r\n", e.error_message()),
+ };
+
+ print!("\r{status_string}{}", se.lock().unwrap().prompt());
+ let _ = std::io::stdout().lock().flush();
+ }
+}
- print!("\r{status_string}{}", se.lock().unwrap().prompt());
- let _ = std::io::stdout().lock().flush();
+pub fn run_script(se: Arc<Mutex<Session>>, script: crate::parse::Script) {
+ for stmt in script.stmts {
+ run(se.clone(), stmt);
+ }
}
#[derive(Debug)]