From 94b5c5054b2cad555f89ab6327b2e3cf289b25cd Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Mon, 15 Jan 2024 17:41:09 +0100 Subject: [PATCH] Fixed missing ARDUINO_USER_AGENT env var --- commands/compile/compile.go | 1 + internal/arduino/builder/builder.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/commands/compile/compile.go b/commands/compile/compile.go index 75e86b8f52d..0beebfa56ca 100644 --- a/commands/compile/compile.go +++ b/commands/compile/compile.go @@ -199,6 +199,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream paths.NewPathList(req.GetLibrary()...), outStream, errStream, req.GetVerbose(), req.GetWarnings(), progressCB, + pme.GetEnvVarsForSpawnedProcess(), ) if err != nil { if strings.Contains(err.Error(), "invalid build properties") { diff --git a/internal/arduino/builder/builder.go b/internal/arduino/builder/builder.go index 7cbe0544a26..40ca74e44d2 100644 --- a/internal/arduino/builder/builder.go +++ b/internal/arduino/builder/builder.go @@ -92,6 +92,8 @@ type Builder struct { libsDetector *detector.SketchLibrariesDetector + toolEnv []string + // This is a function used to parse the output of the compiler // It is used to extract errors and warnings compilerOutputParser diagnostics.CompilerOutputParserCB @@ -133,6 +135,7 @@ func NewBuilder( libraryDirs paths.PathList, stdout, stderr io.Writer, verbose bool, warningsLevel string, progresCB rpc.TaskProgressCB, + toolEnv []string, ) (*Builder, error) { buildProperties := properties.NewMap() if boardBuildProperties != nil { @@ -216,6 +219,7 @@ func NewBuilder( buildArtifacts: &buildArtifacts{}, targetPlatform: targetPlatform, actualPlatform: actualPlatform, + toolEnv: toolEnv, libsDetector: detector.NewSketchLibrariesDetector( libsManager, libsResolver, useCachedLibrariesResolution, @@ -521,7 +525,7 @@ func (b *Builder) prepareCommandForRecipe(buildProperties *properties.Map, recip } } - command, err := paths.NewProcess(nil, parts...) + command, err := paths.NewProcess(b.toolEnv, parts...) if err != nil { return nil, err }