11 lines
304 B
Rust
11 lines
304 B
Rust
//! I/O utilities.
|
|
|
|
use proxmox_sys::fd::Fd;
|
|
|
|
/// safe wrapper for `nix::unistd::pipe2` defaulting to `O_CLOEXEC` and guarding the file
|
|
/// descriptors.
|
|
pub fn pipe() -> Result<(Fd, Fd), nix::Error> {
|
|
let (pin, pout) = nix::unistd::pipe2(nix::fcntl::OFlag::O_CLOEXEC)?;
|
|
Ok((Fd(pin), Fd(pout)))
|
|
}
|