Use tokio to asynchronously read from pipe
Avoids either `spawn_blocking`, or potentially blocking call in an async function (though it shouldn't block for long).
This commit is contained in:
parent
621de17cad
commit
82fb781746
2 changed files with 8 additions and 12 deletions
|
|
@ -335,7 +335,7 @@ where
|
|||
// https://systemd.io/DESKTOP_ENVIRONMENTS
|
||||
//
|
||||
// Similar to what Gnome sets, for now.
|
||||
if let Ok(Some(pid)) = tokio::task::spawn_blocking(|| crate::process::spawn(cmd)).await {
|
||||
if let Some(pid) = crate::process::spawn(cmd).await {
|
||||
if let Ok(session) = zbus::Connection::session().await {
|
||||
if let Ok(systemd_manager) = SystemdMangerProxy::new(&session).await {
|
||||
let _ = systemd_manager
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue