Started impl of feature `progress-reactive`: Addded `.resize_bar()` (`CommandKind::Resize`) to update progress bar max size to fit recalculated terminal width.
# Without this feature enabled, `leanify` subprocesses will receive terminating `SIGINT`s as normal.
shutdown=["libc"]
# TODO: Implement this to: Capture `SIGWINCH` events and re-size + re-render the progress bar to the new terminal width. (XXX: Use a background thread (outside the thread-pool, as it's blocking) listening on `signal_hooks::Signals.forever()` for this that sends events through a shared Tokio `CondVar<TerminalWidth>` notify_all() call.)
.map(|_|None)//TODO: Can the shutdown future set an `is_interrupted` var we can use to return a non-zero exit code from a SIGINT graceful shutdown here (e.g. `is_interrupted.then_some(1)`)? Do something like this...
}
#[tokio::main]
asyncfnmain(){
prettify_expect(work().await.map_err(|e|e.to_string()),"exited with error");
ifletSome(code)=prettify_expect(work().await.map_err(|e|e.to_string()),"exited with error"){
// Exiting with error (non-zero) code
std::process::exit(code.get());
}
}
#[inline]fnprettify_expect<T,E,S>(res: Result<T,E>,msg: S)-> T
todo!("progress-reactive: Spawn the `signal_hooks` thread and set up the Tokio `CondVar` to wait on in a background task, sending `Resize{None} to `progress` when an event comes in.");
letflags=flags.clone();// XXX: Can we remove this clone somehow? It's kinda big this structure and we only need to do this because of not being able to exclude 'cli from `+ use<>` in the `async fn do_work()` as it's an `async fn` and not a `fn() -> impl Future`...