Skip to content

Commit

Permalink
secret: retrieve: Accept AsFd as argument
Browse files Browse the repository at this point in the history
This is more general. Since BorrowedFd implements AsFd this should not
really break users.
  • Loading branch information
A6GibKm authored and bilelmoussaoui committed Oct 31, 2024
1 parent 2c20231 commit c5627f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/desktop/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! let secret = Secret::new().await?;
//!
//! let (mut x1, x2) = std::os::unix::net::UnixStream::pair()?;
//! secret.retrieve(&x2.as_fd()).await?;
//! secret.retrieve(&x2).await?;
//! drop(x2);
//! let mut buf = Vec::new();
//! x1.read_to_end(&mut buf)?;
Expand Down Expand Up @@ -98,14 +98,14 @@ pub async fn retrieve() -> Result<Vec<u8>, Error> {
#[cfg(feature = "tokio")]
let mut x1 = {
let (x1, mut x2) = UnixStream::pair()?;
proxy.retrieve(&x2.as_fd()).await?;
proxy.retrieve(&x2).await?;
x2.shutdown().await?;
x1
};
#[cfg(feature = "async-std")]
let mut x1 = {
let (x1, x2) = UnixStream::pair()?;
proxy.retrieve(&x2.as_fd()).await?;
proxy.retrieve(&x2).await?;
x2.shutdown(Shutdown::Write)?;
x1
};
Expand Down

0 comments on commit c5627f6

Please sign in to comment.