aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/main.rs')
-rw-r--r--crates/shirabe/src/main.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/shirabe/src/main.rs b/crates/shirabe/src/main.rs
index 8e8e3299..2ae6d903 100644
--- a/crates/shirabe/src/main.rs
+++ b/crates/shirabe/src/main.rs
@@ -8,6 +8,19 @@ fn main() {
std::sync::LazyLock::force(&PHP_ENV);
std::sync::LazyLock::force(&PHP_SERVER);
+ // The single process-wide tokio Runtime. `shirabe::run` and everything under it
+ // (Command::execute and friends) is still synchronous top to bottom; entering the runtime
+ // here (rather than driving `run` via `.block_on`) just makes it ambiently available via
+ // `Handle::try_current()` for `util::sync_executor::block_on`'s many scattered call sites,
+ // which ride it through `tokio::task::block_in_place` instead of each spinning up (or
+ // busy-spin-polling without) their own. See sync_executor.rs for the TODO(phase-e) tracking
+ // the eventual goal of propagating `async fn` all the way up to here instead.
+ let runtime = tokio::runtime::Builder::new_multi_thread()
+ .enable_all()
+ .build()
+ .expect("failed to build the top-level tokio runtime");
+ let _runtime_guard = runtime.enter();
+
let result = shirabe::run(std::env::args().collect());
let exit_code = match result {
Ok(exit_code) => exit_code,