Most of the refactor. Need to switch machines.

This commit is contained in:
Olivia Brooks
2026-02-15 09:36:04 -05:00
parent dda863e512
commit e41d4bcd76
61 changed files with 3390 additions and 618 deletions

11
crates/io/src/error.rs Normal file
View File

@@ -0,0 +1,11 @@
use derive_more::{Display, From};
pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug, From, Display)]
pub enum Error {
#[from]
Io(std::io::Error),
#[from]
Popen(subprocess::PopenError),
}

30
crates/io/src/lib.rs Normal file
View File

@@ -0,0 +1,30 @@
mod error;
use std::ffi;
pub use error::{Error, Result};
pub fn run_process<S>(argv: &[S]) -> Result<(Option<String>, Option<String>)>
where
S: AsRef<ffi::OsStr>,
{
let mut process = subprocess::Popen::create(
argv,
subprocess::PopenConfig {
stdout: subprocess::Redirection::Pipe,
..Default::default()
},
)?;
let result = process.communicate(None)?;
if process
.wait_timeout(std::time::Duration::from_secs(5))
.is_err()
|| process.exit_status().is_none()
{
process.terminate()?;
}
Ok(result)
}