mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-25 22:51:21 +02:00
fix(wm): socket cleanup on exit
This commit ensures that Shutdown signals will be sent to subscriber sockets and that "komorebi.sock" will be cleaned up on exit. Alongside these changes, komorebi_client::send_message no longer retries so that integrators can receive feedback via io::Result errors when komorebi is not running.
This commit is contained in:
@@ -57,16 +57,10 @@ const KOMOREBI: &str = "komorebi.sock";
|
||||
|
||||
pub fn send_message(message: &SocketMessage) -> std::io::Result<()> {
|
||||
let socket = DATA_DIR.join(KOMOREBI);
|
||||
let mut connected = false;
|
||||
while !connected {
|
||||
if let Ok(mut stream) = UnixStream::connect(&socket) {
|
||||
connected = true;
|
||||
stream.write_all(serde_json::to_string(message)?.as_bytes())?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
let mut stream = UnixStream::connect(socket)?;
|
||||
stream.write_all(serde_json::to_string(message)?.as_bytes())
|
||||
}
|
||||
|
||||
pub fn send_query(message: &SocketMessage) -> std::io::Result<String> {
|
||||
let socket = DATA_DIR.join(KOMOREBI);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user