Skip to content

Conversation

@jonbarlo
Copy link
Contributor

What was the end-user or developer problem that led to this PR?

Closes #8824

Summary of the Problem:

RUBYOPT=-rlogger bundle exec ruby ... sets RUBYOPT for both Bundler and the child, which can break Bundler.
You want bundle exec RUBYOPT=-rlogger ruby ... to set RUBYOPT only for the child process.
The workaround (bundle exec sh -c 'RUBYOPT=... exec ruby ...') is not cross-platform, it will fail for Windows operative system as stated and probed by the reporter.

This is how most POSIX shells work, but Ruby’s bundle exec currently does not support this natively.

What is your fix for the problem, implemented in this PR?

Allow users to specify environment variables that are set only for the child process launched by bundle exec, not for Bundler itself.

Syntax

  • Preferred:
    bundle exec RUBYOPT=-rlogger ruby ...

Make sure the following tasks are checked

@indirect
Copy link
Contributor

This seems reasonable to me, although I would like to hear if @deivid-rodriguez has any concerns before merging.

@deivid-rodriguez
Copy link
Contributor

I will have a look at the feature request and implementation 👍. But first thought is whether an --env argument ala docker run --env would be better?

@jonbarlo
Copy link
Contributor Author

jonbarlo commented Aug 5, 2025

@deivid-rodriguez hello good morning sir i have pushed changes to support the --env argument "a la docker" whenever you have a chance mind taking a look and letting me know please?

cc: @indirect

@deivid-rodriguez
Copy link
Contributor

I see now both modes are implemented, I don't want the extra complexity, let's choose one.

I'm not totally sure which one is better, but I think I slightly lean towards --env because it's more explicit and maybe more cross-platform friendly (Windows users are probably not used to FOO=bar command syntax of posix shells).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants