Skip to content

Commit

Permalink
Move deadline to separate select-arm
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusPettersson98 committed Dec 13, 2024
1 parent 87669a9 commit df24377
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions talpid-core/src/split_tunnel/macos/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,23 @@ async fn parse_logger_status(
}
});

let proc = tokio::time::timeout(EARLY_FAIL_TIMEOUT, proc);
let deadline = tokio::time::sleep(EARLY_FAIL_TIMEOUT);

tokio::select! {
// Received standard err/out
biased; need_full_disk_access = &mut need_full_disk_access => {
need_full_disk_access.unwrap_or(NeedFda::No)
}
proc_result = proc => {
if let Ok(Ok(_exit_status)) = proc_result {
if let Ok(_exit_status) = proc_result {
// Process exited
return need_full_disk_access.await.unwrap_or(NeedFda::No);
}
// Timeout or `Child::wait`` returned an error
// `Child::wait`` returned an error
NeedFda::No
}
// Timed out while checking for full-disk access
_ = deadline => NeedFda::No,
}
}

Expand Down

0 comments on commit df24377

Please sign in to comment.