some semblance of an event loop

This commit is contained in:
Qyriad 2026-03-11 14:26:59 +01:00
parent a72a48f92b
commit 74c2eaf66d
8 changed files with 384 additions and 14 deletions

View file

@ -13,8 +13,8 @@ pub(crate) mod prelude {
pub use std::{
error::Error as StdError,
ffi::{OsStr, OsString},
fmt::{Display, Formatter, Result as FmtResult},
io::{Error as IoError, Read, Seek, SeekFrom, Write},
fmt::{Debug, Display, Formatter, Result as FmtResult},
io::{Error as IoError, ErrorKind as IoErrorKind, Read, Seek, SeekFrom, Write},
path::{Path, PathBuf},
process::{Command, ExitCode},
str::FromStr,
@ -33,6 +33,8 @@ pub(crate) mod prelude {
#[cfg(unix)]
pub use fs_err::os::unix::fs::{FileExt, OpenOptionsExt};
pub use bstr::ByteSlice;
pub use tap::{Pipe, Tap, TapFallible};
pub use tracing::{Level, debug, error, info, trace, warn};
@ -44,11 +46,13 @@ pub mod args;
pub use args::{AppendCmd, Args};
mod color;
pub use color::{_CLI_ENABLE_COLOR, SHOULD_COLOR};
mod daemon;
pub use daemon::Daemon;
mod daemon_io;
pub use daemon_io::OwnedFdWithFlags;
pub mod line;
mod nixcmd;
pub use line::Line;
mod nixcmd;
pub mod source;
pub use source::{SourceFile, SourceLine};
@ -67,6 +71,8 @@ use _regex::Regex;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use crate::args::DaemonCmd;
pub const ASCII_WHITESPACE: &[char] = &['\t', '\n', '\x0C', '\r', ' '];
/// Regex pattern to extract the priority in a `lib.mkOverride` call.
@ -118,6 +124,13 @@ pub fn do_append(args: Arc<Args>, append_args: AppendCmd) -> Result<(), BoxDynEr
Ok(())
}
//#[tracing::instrument(level = "debug")]
pub fn do_daemon(args: Arc<Args>, daemon_args: DaemonCmd) -> Result<(), BoxDynError> {
let mut daemon = Daemon::from_stdin();
daemon.enter_loop().unwrap();
todo!();
}
#[derive(Debug, Clone, PartialEq, Hash, Serialize, Deserialize)]
pub struct DefinitionWithLocation {
pub file: Box<Path>,