Merge pull request #130 from lilyinstarlight/fix/get-session-by-pid-race
Fix race condition when getting login session
This commit is contained in:
commit
4ddb320dae
1 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ use logind_zbus::{
|
|||
manager::{InhibitType, ManagerProxy},
|
||||
session::SessionProxy,
|
||||
};
|
||||
use std::{any::TypeId, error::Error, os::fd::OwnedFd, process, sync::Arc};
|
||||
use std::{any::TypeId, error::Error, os::fd::OwnedFd, sync::Arc};
|
||||
use tokio::time;
|
||||
use zbus::Connection;
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ pub fn subscription() -> Subscription<Message> {
|
|||
pub async fn handler(msg_tx: &mut mpsc::Sender<Message>) -> Result<(), Box<dyn Error>> {
|
||||
let connection = Connection::system().await?;
|
||||
let manager = ManagerProxy::new(&connection).await?;
|
||||
let session_path = manager.get_session_by_PID(process::id()).await?;
|
||||
let session_path = manager.get_session_by_PID(std::os::unix::process::parent_id()).await?;
|
||||
let session = SessionProxy::builder(&connection)
|
||||
.path(&session_path)?
|
||||
.build()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue