Compare commits
1 Commits
plugin
...
27ad93d749
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27ad93d749
|
13
Cargo.lock
generated
13
Cargo.lock
generated
@@ -1401,6 +1401,18 @@ dependencies = [
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.30.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.3"
|
||||
@@ -1973,6 +1985,7 @@ dependencies = [
|
||||
"genai",
|
||||
"human-panic",
|
||||
"irc",
|
||||
"nix",
|
||||
"rstest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
||||
@@ -15,6 +15,10 @@ serde_json = "1.0"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = "0.3"
|
||||
|
||||
[dependencies.nix]
|
||||
version = "0.30.1"
|
||||
features = [ "fs" ]
|
||||
|
||||
[dependencies.clap]
|
||||
version = "4.5"
|
||||
features = [ "derive" ]
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
use std::{collections::VecDeque, path::Path, sync::Arc};
|
||||
|
||||
use color_eyre::Result;
|
||||
//use nix::{NixPath, sys::stat, unistd::mkfifo};
|
||||
use tokio::{
|
||||
// fs::File,
|
||||
io::AsyncWriteExt,
|
||||
net::{UnixListener, UnixStream},
|
||||
net::{
|
||||
UnixListener,
|
||||
UnixStream,
|
||||
// unix::pipe::{self, Receiver},
|
||||
},
|
||||
sync::{RwLock, broadcast},
|
||||
};
|
||||
use tracing::{error, info};
|
||||
@@ -46,8 +52,20 @@ impl EventManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn start_listening(self: Arc<Self>, path: impl AsRef<Path>) {
|
||||
let listener = UnixListener::bind(path).unwrap();
|
||||
// NB: This assumes it has exclusive control of the FIFO.
|
||||
// async fn start_fifo<P>(path: &P) -> Result<()>
|
||||
// where
|
||||
// P: AsRef<Path> + NixPath + ?Sized,
|
||||
// {
|
||||
// // Just delete the old FIFO if it exists.
|
||||
// let _ = std::fs::remove_file(path);
|
||||
// mkfifo(path, stat::Mode::S_IRWXU)?;
|
||||
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
pub async fn start_listening(self: Arc<Self>, broadcast_path: impl AsRef<Path>) {
|
||||
let listener = UnixListener::bind(broadcast_path).unwrap();
|
||||
|
||||
loop {
|
||||
match listener.accept().await {
|
||||
|
||||
Reference in New Issue
Block a user