Skip to content

Commit

Permalink
Fix darwin compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
ifd3f committed Aug 21, 2023
1 parent bc3dcbe commit 580f6e1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/burn/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Handle {

debug!("Starting child process with command: {:?}", cmd);
let child = if escalate {
run_escalate(cmd).await?
run_escalate(&cmd).await?
} else {
tokio::process::Command::from(cmd).spawn()?
};
Expand Down
4 changes: 2 additions & 2 deletions src/escalation/darwin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::unix::{Command, EscalationMethod};

pub async fn wrap_osascript_escalation(raw: Command<'_>) -> anyhow::Result<tokio::process::Child> {
pub async fn wrap_osascript_escalation(raw: &Command<'_>) -> anyhow::Result<tokio::process::Child> {
for _ in 0..3 {
// User-friendly thing that lets you use touch ID if you wanted.
// https://apple.stackexchange.com/questions/23494/what-option-should-i-give-the-sudo-command-to-have-the-password-asked-through-a
Expand All @@ -19,6 +19,6 @@ pub async fn wrap_osascript_escalation(raw: Command<'_>) -> anyhow::Result<tokio
}
}

let cmd: tokio::process::Command = EscalationMethod::Sudo.wrap_command(raw).into();
let mut cmd: tokio::process::Command = EscalationMethod::Sudo.wrap_command(raw).into();
Ok(cmd.kill_on_drop(true).spawn()?)
}
6 changes: 3 additions & 3 deletions src/escalation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ pub enum Error {
}

#[cfg(target_os = "linux")]
pub async fn run_escalate(cmd: Command<'_>) -> anyhow::Result<tokio::process::Child> {
pub async fn run_escalate(cmd: &Command<'_>) -> anyhow::Result<tokio::process::Child> {
use self::unix::EscalationMethod;

let mut cmd: tokio::process::Command = EscalationMethod::detect()?.wrap_command(&cmd).into();
let mut cmd: tokio::process::Command = EscalationMethod::detect()?.wrap_command(cmd).into();
cmd.kill_on_drop(true);
Ok(cmd.spawn()?)
}

#[cfg(target_os = "macos")]
pub async fn run_escalate(cmd: Command<'_>) -> anyhow::Result<tokio::process::Child> {
pub async fn run_escalate(cmd: &Command<'_>) -> anyhow::Result<tokio::process::Child> {
use self::darwin::wrap_osascript_escalation;

wrap_osascript_escalation(cmd).await
Expand Down

0 comments on commit 580f6e1

Please sign in to comment.