Skip to main content

ask_then

Function ask_then 

Source
pub fn ask_then(
    version: String,
    staged: Staged,
    stopping: Vec<String>,
    data_dir: PathBuf,
    host_pid: Option<u32>,
    confirmed: bool,
    on_yes: impl FnOnce(Staged) + Send + 'static,
)
Expand description

Restart as srv asked, on a thread of its own. When the restart is confirmed (srv’s line says so: the user’s own click or turn, or an approved request whose in-app countdown ran out with no veto) nothing more is asked: no native dialog, so a computer nobody sits at restarts. The staged file was checked again before this (staged), and on a .deb or .rpm install the OS’s own permission prompt still stands: that one is the system’s, not a question of ours. A request that does not say it is confirmed is asked about, and on_yes is called only for an explicit Yes that still counts (answer_counts): one given within ANSWER_WITHIN, to the latest request. One dialog at a time: a newer request closes the open one, and a dialog closes itself (as No) once its time is up. A Yes that slips past either is told it expired. stopping lists what agents left running that the restart stops (stopping_note); the dialog names it. host_pid is the host’s process id: on Windows the dialog sits over the host’s window, so it comes up in front of the person instead of waiting on the taskbar.