From 3da19e8603c00c02ec7e24ea8910a7c386b09018 Mon Sep 17 00:00:00 2001 From: syn Date: Fri, 14 Feb 2020 13:09:44 +0300 Subject: Improve error handling --- src/backends/clang.rs | 4 ++-- src/backends/mod.rs | 4 ++-- src/backends/python.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/backends') diff --git a/src/backends/clang.rs b/src/backends/clang.rs index 0947b49..11c316a 100644 --- a/src/backends/clang.rs +++ b/src/backends/clang.rs @@ -5,7 +5,7 @@ use std::io::{ Result as IoResult, Error, ErrorKind }; use std::process::{ Command }; use std::collections::hash_map::DefaultHasher; use std::hash::{ Hash, Hasher }; -use crate::wait::{ WaitInfo, wait_child }; +use crate::wait::{ ChildExitStatus, wait_child }; use std::time::Duration; @@ -81,7 +81,7 @@ impl Backend for ClangBackend { } } - fn run(&self, fname: &Path) -> Result { + fn run(&self, fname: &Path) -> Result { let binary_fname = self.build(fname)?; let proc = Command::new(&binary_fname) diff --git a/src/backends/mod.rs b/src/backends/mod.rs index 3bf9fc7..a5d2d28 100644 --- a/src/backends/mod.rs +++ b/src/backends/mod.rs @@ -2,7 +2,7 @@ use std::path::{ Path, PathBuf }; use std::env::temp_dir; use lazy_static::lazy_static; use std::io::{ Error, ErrorKind }; -use crate::wait::{ WaitInfo }; +use crate::wait::ChildExitStatus; pub mod python; pub mod clang; @@ -21,7 +21,7 @@ lazy_static! { pub trait Backend { fn get_template(&self) -> Option<&str>; - fn run(&self, fname: &Path) -> Result; + fn run(&self, fname: &Path) -> Result; } fn mk_tmp_dir() -> std::io::Result<&'static std::path::PathBuf> { diff --git a/src/backends/python.rs b/src/backends/python.rs index e3569b1..3ee7b35 100644 --- a/src/backends/python.rs +++ b/src/backends/python.rs @@ -2,7 +2,7 @@ use serde_derive::{ Serialize, Deserialize }; use crate::backends::{ Backend, RunError }; use std::process::{ Command }; use std::path::Path; -use crate::wait::{ wait_child, WaitInfo }; +use crate::wait::{ wait_child, ChildExitStatus }; #[derive(Debug, Serialize, Deserialize, Default)] pub struct PythonBackend { @@ -32,7 +32,7 @@ impl Backend for PythonBackend { } } - fn run(&self, fname: &Path) -> Result { + fn run(&self, fname: &Path) -> Result { let timer = std::time::Instant::now(); let child = Command::new(self.get_interpreter()) -- cgit v1.2.1-18-gbd029