diff --git a/src/unix.rs b/src/unix.rs index b61a85c..69c30e5 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -90,9 +90,9 @@ impl Client { pub unsafe fn open(s: &str) -> Result { match (Self::from_fifo(s), Self::from_pipe(s)) { - (Some(result), None) | (None, Some(result)) => result, + (Some(Ok(c)), _) | (_, Some(Ok(c))) => Ok(c), + (Some(Err(e)), _) | (_, Some(Err(e))) => Err(e), (None, None) => Err(ErrFromEnv::ParseEnvVar), - (Some(_), Some(_)) => unreachable!(), } } diff --git a/src/windows.rs b/src/windows.rs index 7ae40e8..d67a373 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -141,7 +141,7 @@ impl Client { let sem = OpenSemaphoreA(SYNCHRONIZE | SEMAPHORE_MODIFY_STATE, FALSE, name.as_ptr()); if sem.is_null() { - Err(CannotAcquireSemaphore) + Err(ErrFromEnv::CannotAcquireSemaphore) } else { Ok(Client { sem: Handle(sem),