From 9cf061bd75ea2847e0cf4d6d52188f6be3b747d5 Mon Sep 17 00:00:00 2001 From: seph Date: Wed, 14 Feb 2024 23:25:08 -0500 Subject: [PATCH] Don't trigger TUF when running from build --- cmd/launcher/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/launcher/main.go b/cmd/launcher/main.go index 08e350ae2..422cf7e55 100644 --- a/cmd/launcher/main.go +++ b/cmd/launcher/main.go @@ -48,12 +48,19 @@ func main() { Level: slog.LevelInfo, })) + // If this is a development build directory, we want to skip the TUF lookups and just run + // the requested build. Don't care about errors here. This is developer experience shim + inBuildDir := false + if execPath, err := os.Executable(); err == nil { + inBuildDir = strings.Contains(execPath, filepath.Join("launcher", "build")) && !env.Bool("LAUNCHER_FORCE_UPDATE_IN_BUILD", false) + } + // If there's a newer version of launcher on disk, use it. // Allow a caller to set `LAUNCHER_SKIP_UPDATES` as a way to // skip exec'ing an update. This helps prevent launcher from // fork-bombing itself. This is an ENV, because there's no // good way to pass it through the flags. - if !env.Bool("LAUNCHER_SKIP_UPDATES", false) { + if !env.Bool("LAUNCHER_SKIP_UPDATES", false) && !inBuildDir { runNewerLauncherIfAvailable(ctx, systemSlogger.Logger) }