hypha: init will now watch process in background

This commit is contained in:
Alex Zenla
2024-01-31 01:40:42 -08:00
parent b6af5f54bd
commit 86c512474a
7 changed files with 77 additions and 20 deletions

View File

@ -55,7 +55,7 @@ pub trait XsdInterface {
Ok(match self.read_string(path) {
Ok(value) => Some(value),
Err(error) => {
if error.to_string() == "ENOENT" {
if error.is_noent_response() {
None
} else {
return Err(error);
@ -68,7 +68,7 @@ pub trait XsdInterface {
Ok(match self.list(path) {
Ok(value) => value,
Err(error) => {
if error.to_string() == "ENOENT" {
if error.is_noent_response() {
Vec::new()
} else {
return Err(error);
@ -115,7 +115,7 @@ impl XsdClient {
trace!("rm tx={tx} path={path}");
let result = self.socket.send_single(tx, XSD_RM, path);
if let Err(error) = result {
if error.to_string() == "ENOENT" {
if error.is_noent_response() {
return Ok(true);
}
return Err(error);

View File

@ -28,4 +28,13 @@ pub enum Error {
InvalidPermissions,
}
impl Error {
pub fn is_noent_response(&self) -> bool {
match self {
Error::ResponseError(message) => message == "ENOENT",
_ => false,
}
}
}
pub type Result<T> = std::result::Result<T, Error>;