From 96d6a0a2b562f81c5c14532487ce03a1a9065e6b Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Sun, 29 Sep 2024 17:26:45 +0200 Subject: Implement sub-process based tester --- rust/src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'rust/src/main.rs') diff --git a/rust/src/main.rs b/rust/src/main.rs index b0e8ed9..8d52c46 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -1,16 +1,18 @@ use std::{ env::args, - io::{stdin, stdout}, + io::{stdin, stdout, IsTerminal}, }; -use lambda::io::{eval_file, repl}; +use lambda::io::{batch_eval, eval_file, repl}; fn main() { if args().count() > 1 { for file in args().skip(1) { println!("{}", eval_file(&file)); } - } else { + } else if stdin().is_terminal() { repl(&mut stdin(), &mut stdout()); + } else { + batch_eval(&mut stdin(), &mut stdout()); } } -- cgit v1.2.3