summaryrefslogtreecommitdiffstats
path: root/src/conf.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf.rs')
-rw-r--r--src/conf.rs51
1 files changed, 2 insertions, 49 deletions
diff --git a/src/conf.rs b/src/conf.rs
index febfef5..cc281f0 100644
--- a/src/conf.rs
+++ b/src/conf.rs
@@ -1,14 +1,12 @@
use serde_derive::{ Serialize, Deserialize };
use std::path::{ PathBuf, Path };
use toml::de;
-use log::{ error, trace };
-use std::io::prelude::*;
-use nix::sys::wait::WaitStatus;
+use log::{ error };
type Error = std::io::Error;
use std::io::ErrorKind;
-use crate::backends::{ Backend, PythonBackend, ClangBackend, RunError };
+use crate::backends::{ Backend, PythonBackend, ClangBackend };
#[derive(Debug, Serialize, Deserialize, Default)]
@@ -42,51 +40,6 @@ impl Conf {
_ => None
}
}
-
- pub fn run(
- &self,
- fname: &Path,
- show_time: bool,
- show_mem: bool
- ) -> Result<(), RunError> {
- match self.get_backend(fname) {
- Some(backend) => backend.run(fname).map(|info| {
- match info.status {
- WaitStatus::Exited(_pid, ret) => match ret {
- 0 => {
- if show_time {
- println!("wall time: {:?}", info.wall_time);
- }
- if show_mem {
- println!("rss: {}K", info.usage.ru_maxrss);
- }
- },
- _ => error!("process exited with {}", ret)
- },
- WaitStatus::Signaled(pid, sig, coredump) => {
- error!(
- "process killed by {} {}. was {}",
- sig,
- if coredump {"(core dumped)"} else {""},
- pid
- );
- },
- _ => error!("process signaled, but not exited")
- }
- }),
- None => Err(Error::new(ErrorKind::InvalidData, "Backend not found").into())
- }
- }
-
- pub fn make(&self, fname: &Path) -> Result<(), RunError> {
- trace!("Template: {:?}", self.get_template(&fname));
-
- std::fs::File::create(fname)?
- .write_all(self.get_template(fname).as_bytes())?;
-
- trace!("Written some bytes to {}", fname.to_string_lossy());
- Ok(())
- }
}