Make non-interactive code work again

This commit is contained in:
greg 2019-05-14 01:57:31 -07:00
parent 694c152fcd
commit 198f93c533
2 changed files with 11 additions and 4 deletions

View File

@ -56,7 +56,7 @@ fn run_noninteractive(filename: &str, languages: Vec<Box<ProgrammingLanguageInte
println!("Source file lacks extension"); println!("Source file lacks extension");
exit(1); exit(1);
}); });
let language = Box::new(languages.into_iter().find(|lang| lang.get_source_file_suffix() == ext) let mut language = Box::new(languages.into_iter().find(|lang| lang.get_source_file_suffix() == ext)
.unwrap_or_else(|| { .unwrap_or_else(|| {
println!("Extension .{} not recognized", ext); println!("Extension .{} not recognized", ext);
exit(1); exit(1);
@ -66,8 +66,16 @@ fn run_noninteractive(filename: &str, languages: Vec<Box<ProgrammingLanguageInte
let mut buffer = String::new(); let mut buffer = String::new();
source_file.read_to_string(&mut buffer).unwrap(); source_file.read_to_string(&mut buffer).unwrap();
println!("NON-INTERACTIVE OUTPUT DOESN'T WORK YET"); let request = ComputationRequest {
panic!(); source: &buffer,
debug_requests: vec![]
};
let response = language.run_computation(request);
match response.main_output {
Ok(s) => println!("{}", s),
Err(s) => println!("{}", s)
};
} }

View File

@ -1,5 +1,4 @@
use std::fmt::Write as FmtWrite; use std::fmt::Write as FmtWrite;
use std::io::Write;
use std::sync::Arc; use std::sync::Arc;
use std::collections::HashSet; use std::collections::HashSet;