some semblance of socket support
This commit is contained in:
parent
470fe05b76
commit
398fccc5d0
7 changed files with 271 additions and 28 deletions
24
src/lib.rs
24
src/lib.rs
|
|
@ -38,12 +38,15 @@ pub(crate) mod prelude {
|
|||
pub use tap::{Pipe, Tap, TapFallible};
|
||||
|
||||
pub use tracing::{Level, debug, error, info, trace, warn};
|
||||
|
||||
pub use crate::boxext::BoxedPathExt;
|
||||
}
|
||||
|
||||
use prelude::*;
|
||||
|
||||
pub mod args;
|
||||
pub use args::{AppendCmd, Args};
|
||||
mod boxext;
|
||||
mod color;
|
||||
pub use color::{_CLI_ENABLE_COLOR, SHOULD_COLOR};
|
||||
mod daemon;
|
||||
|
|
@ -54,6 +57,7 @@ pub mod line;
|
|||
pub use line::Line;
|
||||
mod nixcmd;
|
||||
pub mod source;
|
||||
use rustix::fs::Mode;
|
||||
pub use source::{SourceFile, SourceLine};
|
||||
|
||||
#[cfg(all(not(feature = "regex-full"), not(feature = "regex-lite")))]
|
||||
|
|
@ -125,10 +129,24 @@ pub fn do_append(args: Arc<Args>, append_args: AppendCmd) -> Result<(), BoxDynEr
|
|||
}
|
||||
|
||||
//#[tracing::instrument(level = "debug")]
|
||||
pub fn do_daemon(args: Arc<Args>, daemon_args: DaemonCmd) -> Result<(), BoxDynError> {
|
||||
let mut daemon = Daemon::from_stdin();
|
||||
pub fn do_daemon(_args: Arc<Args>, daemon_args: DaemonCmd) -> Result<(), BoxDynError> {
|
||||
// FIXME: make configurable?
|
||||
let _ = rustix::process::umask(Mode::from_bits_retain(0o600).complement());
|
||||
|
||||
let mut daemon = match daemon_args {
|
||||
DaemonCmd { stdin: true, .. } => Daemon::from_stdin(),
|
||||
DaemonCmd { socket: None, .. } => Daemon::open_default_socket()?,
|
||||
DaemonCmd {
|
||||
socket: Some(socket),
|
||||
..
|
||||
} => Daemon::from_unix_socket_path(&socket)?,
|
||||
};
|
||||
|
||||
daemon.enter_loop().unwrap();
|
||||
todo!();
|
||||
|
||||
info!("daemon has exited");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Hash, Serialize, Deserialize)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue