diff options
| author | MaxVerevkin <maxxverrr@gmail.com> | 2024-03-30 19:34:08 +0200 |
|---|---|---|
| committer | MaxVerevkin <maxxverrr@gmail.com> | 2024-03-30 19:34:08 +0200 |
| commit | c6da876c3ef4ec9437c269b35bb3b569d159852d (patch) | |
| tree | 08baa332d2de757479e2a5ce8733353aa030200d /src/status_cmd.rs | |
| parent | 310c8755855266b6f4f956c5d5e6feb91fa6d1db (diff) | |
| download | i3bar-mango-c6da876c3ef4ec9437c269b35bb3b569d159852d.tar.gz | |
use libc directly
Diffstat (limited to 'src/status_cmd.rs')
| -rw-r--r-- | src/status_cmd.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/status_cmd.rs b/src/status_cmd.rs index 0d6f049..243b209 100644 --- a/src/status_cmd.rs +++ b/src/status_cmd.rs @@ -1,4 +1,4 @@ -use std::io::{BufWriter, ErrorKind, Write}; +use std::io::{self, BufWriter, ErrorKind, Write}; use std::os::unix::io::AsRawFd; use std::process::{Child, ChildStdin, ChildStdout, Command, Stdio}; @@ -25,10 +25,9 @@ impl StatusCmd { .spawn()?; let output = child.stdout.take().unwrap(); let input = BufWriter::new(child.stdin.take().unwrap()); - nix::fcntl::fcntl( - output.as_raw_fd(), - nix::fcntl::F_SETFL(nix::fcntl::OFlag::O_NONBLOCK), - )?; + if unsafe { libc::fcntl(output.as_raw_fd(), libc::F_SETFL, libc::O_NONBLOCK) } == -1 { + return Err(io::Error::last_os_error().into()); + } Ok(Self { child, output, |
