Skip to content

[breaking] Add env variable to let tools know the cli version and the gRPC client version #1640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 31, 2022
Prev Previous commit
Simplified some appends
  • Loading branch information
cmaglie committed Jan 31, 2022
commit 4ce1742a7098b5d8eb5a96f82c163fe50c62bb1c
3 changes: 1 addition & 2 deletions executils/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ func NewProcess(extraEnv []string, args ...string) (*Process, error) {
p := &Process{
cmd: exec.Command(args[0], args[1:]...),
}
p.cmd.Env = append(p.cmd.Env, os.Environ()...)
p.cmd.Env = append(p.cmd.Env, extraEnv...)
p.cmd.Env = append(os.Environ(), extraEnv...)
TellCommandNotToSpawnShell(p.cmd)

// This is required because some tools detects if the program is running
Expand Down
3 changes: 1 addition & 2 deletions legacy/builder/builder_utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,7 @@ func PrepareCommandForRecipe(buildProperties *properties.Map, recipe string, rem
return nil, errors.WithStack(err)
}
command := exec.Command(parts[0], parts[1:]...)
command.Env = append(command.Env, os.Environ()...)
command.Env = append(command.Env, toolEnv...)
command.Env = append(os.Environ(), toolEnv...)

// if the overall commandline is too long for the platform
// try reducing the length by making the filenames relative
Expand Down
3 changes: 1 addition & 2 deletions legacy/builder/ctags_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ func (s *CTagsRunner) Run(ctx *types.Context) error {
return errors.WithStack(err)
}
command := exec.Command(parts[0], parts[1:]...)
command.Env = append(command.Env, os.Environ()...)
command.Env = append(command.Env, ctx.PackageManager.GetEnvVarsForSpawnedProcess()...)
command.Env = append(os.Environ(), ctx.PackageManager.GetEnvVarsForSpawnedProcess()...)

sourceBytes, _, err := utils.ExecCommand(ctx, command, utils.Capture /* stdout */, utils.Ignore /* stderr */)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions legacy/builder/preprocess_sketch.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ func (s *ArduinoPreprocessorRunner) Run(ctx *types.Context) error {
return errors.WithStack(err)
}
command := exec.Command(parts[0], parts[1:]...)
command.Env = append(command.Env, os.Environ()...)
command.Env = append(command.Env, ctx.PackageManager.GetEnvVarsForSpawnedProcess()...)
command.Env = append(os.Environ(), ctx.PackageManager.GetEnvVarsForSpawnedProcess()...)

if runtime.GOOS == "windows" {
// chdir in the uppermost directory to avoid UTF-8 bug in clang (https://github.com/arduino/arduino-preprocessor/issues/2)
Expand Down