Make non-interactive code work again
This commit is contained in:
parent
694c152fcd
commit
198f93c533
@ -56,7 +56,7 @@ fn run_noninteractive(filename: &str, languages: Vec<Box<ProgrammingLanguageInte
|
||||
println!("Source file lacks extension");
|
||||
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(|| {
|
||||
println!("Extension .{} not recognized", ext);
|
||||
exit(1);
|
||||
@ -66,8 +66,16 @@ fn run_noninteractive(filename: &str, languages: Vec<Box<ProgrammingLanguageInte
|
||||
let mut buffer = String::new();
|
||||
source_file.read_to_string(&mut buffer).unwrap();
|
||||
|
||||
println!("NON-INTERACTIVE OUTPUT DOESN'T WORK YET");
|
||||
panic!();
|
||||
let request = ComputationRequest {
|
||||
source: &buffer,
|
||||
debug_requests: vec![]
|
||||
};
|
||||
|
||||
let response = language.run_computation(request);
|
||||
match response.main_output {
|
||||
Ok(s) => println!("{}", s),
|
||||
Err(s) => println!("{}", s)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::fmt::Write as FmtWrite;
|
||||
use std::io::Write;
|
||||
use std::sync::Arc;
|
||||
use std::collections::HashSet;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user