Skip to content

Commit

Permalink
Fix full-disk access check getting stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Dec 11, 2024
1 parent 8024c16 commit baac372
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions talpid-core/src/split_tunnel/macos/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use tokio::{
};

const SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(3);
const EARLY_FAIL_TIMEOUT: Duration = Duration::from_millis(100);
const EARLY_FAIL_TIMEOUT: Duration = Duration::from_secs(3);

static MIN_OS_VERSION: LazyLock<MacosVersion> =
LazyLock::new(|| MacosVersion::from_raw_version("13.0.0").unwrap());
Expand Down Expand Up @@ -128,17 +128,19 @@ async fn parse_logger_status(

let mut find_err = tokio::spawn(async move {
tokio::select! {
Ok(Some(line)) = stderr_lines.next_line() => {
result = stderr_lines.next_line() => {
let Ok(Some(line)) = result else {
return true;
};
!matches!(
parse_eslogger_error(&line),
Some(Error::NeedFullDiskPermissions),
)
}
Ok(Some(_)) = stdout_lines.next_line() => {
// Received output, but not an err
_result = stdout_lines.next_line() => {
// Received output, error, or stdout was closed
true
}
else => true,
}
});

Expand All @@ -149,12 +151,14 @@ async fn parse_logger_status(
biased; found_err = &mut find_err => {
found_err.expect("find_err panicked")
}
// Process exited
Ok(Ok(_exit_status)) = proc => {
find_err.await.expect("find_err panicked")
proc_result = proc => {
if let Ok(Ok(_exit_status)) = proc_result {
// Process exited
return find_err.await.expect("find_err panicked");
}
// Timeout or `Child::wait`` returned an error
true
}
// Timeout
else => true,
}
}

Expand Down

0 comments on commit baac372

Please sign in to comment.