Function popol::set_nonblocking

source ·
pub fn set_nonblocking(fd: &dyn AsRawFd, nonblocking: bool) -> Result<i32>
Expand description

Set non-blocking mode on a stream.

This is a convenience function if the source of your stream doesn’t provide an easy way to set it into non-blocking mode.

Example

use std::process;
use popol::set_nonblocking;

let child = process::Command::new("ls")
    .stdout(process::Stdio::piped())
    .spawn()
    .unwrap();
let out = child.stdout.unwrap();

set_nonblocking(&out, true).unwrap();

Return

On Linux, this should always return Ok(0) or Err(_). On other operating systems, consult the fcntl(2) man page.