From f4a7add41e943d8d12ee8f9e6e9335dab6847c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 1 Dec 2026 01:37:41 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20a=20forge=20binary=20star?= =?UTF-8?q?ted=20as=20forge-runner=20acts=20as=20the=20runner,=20so=20a=20?= =?UTF-8?q?standalone=20runner=20that=20auto-updated=20to=20the=20forge=20?= =?UTF-8?q?binary=20keeps=20running=20under=20its=20old=20service=20line?= =?UTF-8?q?=20instead=20of=20exiting=20with=20the=20usage=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/forge-web/src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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)); }