cosmic-session/src/process.rs

11 lines
416 B
Rust
Raw Normal View History

2022-06-22 14:09:59 -04:00
// SPDX-License-Identifier: GPL-3.0-only
2023-11-09 09:50:58 -05:00
use color_eyre::eyre::{Result, WrapErr};
use rustix::io::FdFlags;
use std::os::unix::prelude::*;
2022-10-23 19:48:00 -04:00
pub(crate) fn mark_as_not_cloexec(file: &impl AsFd) -> Result<()> {
2023-11-09 09:50:58 -05:00
let flags = rustix::io::fcntl_getfd(file).wrap_err("failed to get GETFD value of stream")?;
rustix::io::fcntl_setfd(file, flags.difference(FdFlags::CLOEXEC))
.wrap_err("failed to unset CLOEXEC on file")
}