diff --git a/crates/forge-web/src/main.rs b/crates/forge-web/src/main.rs index 48e2bae..650e85e 100644 --- a/crates/forge-web/src/main.rs +++ b/crates/forge-web/src/main.rs @@ -87,6 +87,15 @@ async fn serve(config_path: &std::path::Path) -> Result<(), BoxError> { Ok(()) } +/// Whether the binary was started as `forge-runner`, which a runner's auto-update leaves in place +/// of the standalone runner binary. +fn invoked_as_runner() -> bool { + std::env::args_os() + .next() + .map(std::path::PathBuf::from) + .is_some_and(|path| path.file_name().is_some_and(|name| name == "forge-runner")) +} + /// Splits the raw args into the config path, the `--admin` flag and the positional words. fn parse_args( args: impl Iterator, @@ -164,6 +173,9 @@ fn main() -> ExitCode { // `runner` runs before the forge config is parsed, because its `--config` means the runner // config, not the forge config. let raw: Vec = std::env::args_os().skip(1).collect(); + if invoked_as_runner() { + return forge_runner::cli::main_with_args("forge-runner", raw.into_iter()); + } if raw.first().is_some_and(|arg| arg == "runner") { return forge_runner::cli::main_with_args("forge runner", raw.into_iter().skip(1)); }