bundle exec shouldn't swallow "--verbose" #2102

Closed
bhollis opened this Issue Sep 16, 2012 · 14 comments

Projects

None yet

5 participants

@bhollis
bhollis commented Sep 16, 2012

To repro, make a script called bundle-verbose.rb:

#!/usr/bin/ruby

puts "ARGV: #{ARGV}"

Then run:

bundle exec ruby ./bundle-verbose.rb --verbose

You get [] but I'd expect (and I used to get) ['--verbose']. This interferes with other applications that have a --verbose option.

@indirect
Member

Does it work if you quote the argument to bundle exec? For example, bundle exec "ruby ./bundle-verbose.rb --verbose".

@bhollis
bhollis commented Sep 16, 2012

It does, yes. But before bundler started accepting a --verbose option, it worked without quotes as well. Does --verbose even do anything in bundle exec?

@indirect
Member

Yes, it means that Bundler will print debug-level log information while it runs.

On Sep 16, 2012, at 1:45 AM, Ben Hollis notifications@github.com wrote:

It does, yes. But before bundler started accepting a --verbose option, it worked without quotes as well. Does --verbose even do anything in bundle exec?


Reply to this email directly or view it on GitHub.

@bhollis
bhollis commented Sep 17, 2012

I'd really rather have bundle exec not mess with the programs it's running like that though. Maybe the option could be renamed to --bundler-verbose?

@indirect
Member

Well, previously people complained that they couldn't use the --verbose flag with bundle exec. Not sure if that makes you feel any better, though. :| Honestly, I'm not sure what the right answer is... bundle has a global flag --verbose. Maybe --verbose should both activate Bundler's verbose mode and get passed through to the exec command? That seems like it could produce some very, very surprised people later, though.

@bhollis
bhollis commented Sep 18, 2012

I understand the competing requirements, but I think it'd be great if bundle exec interfered with the program it's executing as much as possible - the idea being that bundle exec <app> is the same as <app> but with your Bundler environment set correctly.

@mrflip
mrflip commented Sep 22, 2012

Bundle exec should only adopt the options between 'exec' and the first non--- arg:

    # --verbose is meant for bundle:
    bundle exec --verbose knife cluster list

   # --verbose is meant for knife:
    bundle exec knife cluster list --verbose 

If anyone worries about the loss of generality, use the convention of "-- means treat the following literally":

   # --verbose is the command:
    bundle exec -- --verbose knife cluster list 
@indirect
Member

I think I agree with that... want to take a stab at implementing it? :D

On Sep 21, 2012, at 8:49 PM, "Philip (flip) Kromer" notifications@github.com wrote:

Bundle exec should only adopt the options between 'exec' and the first non--- arg:

# --verbose is meant for bundle:
bundle exec --verbose knife cluster list

--verbose is meant for knife:

bundle exec knife cluster list --verbose 


Reply to this email directly or view it on GitHub.

@mrflip
mrflip commented Sep 22, 2012

Looking at it now -- if you have any pointers, I'm in #ruby on freenode.

On Fri, Sep 21, 2012 at 10:53 PM, André Arko notifications@github.comwrote:

I think I agree with that... want to take a stab at implementing it? :D

On Sep 21, 2012, at 8:49 PM, "Philip (flip) Kromer" <
notifications@github.com> wrote:

Bundle exec should only adopt the options between 'exec' and the first
non--- arg:

--verbose is meant for bundle:

bundle exec --verbose knife cluster list

--verbose is meant for knife:

bundle exec knife cluster list --verbose

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com/carlhuda/bundler/issues/2102#issuecomment-8785300.

infochimps.com - discover data

@bhollis
bhollis commented Sep 22, 2012

Thanks guys, I think that would be great.

@temujin9 temujin9 referenced this issue in infochimps-labs/ironfan Sep 26, 2012
Closed

bundler swallowing the '--verbose' flag #170

@ryangreenberg

I just got caught by this changed introduced between 1.1.5 and 1.2.0. Previously all the commands in my Procfile ran with bundle exec <command> --verbose which output all the information from the server command. After upgrading to 1.2.x, the --verbose flag doesn't get passed to the command.

I agree with the suggestion that bundle exec only use --verbose if it's before to command to be executed.

$  bundle --version
Bundler version 1.1.5
$  bundle exec argv_test.rb --verbose --hello-world
ARGV: ["--verbose", "--hello-world"]
$ bundle --version                                
Bundler version 1.2.0
$  bundle exec argv_test.rb --verbose --hello-world
ARGV: ["--hello-world"]
@indirect indirect was assigned Oct 29, 2012
@sol
Contributor
sol commented Oct 31, 2012

I'd like to give this a try.

@sol
Contributor
sol commented Nov 1, 2012

There is some tentative code on my do-not-swallow-verbose-on-exec-alt branch. Admittedly, the code is not very nice. A proper solution requires modifications to Thor. I'll give that a shot.

@sol sol referenced this issue in erikhuda/thor Nov 2, 2012
Closed

Simplify Options parser #271

@sol
Contributor
sol commented Nov 4, 2012

A fix is here #2145. It depends on erikhuda/thor#273.

@sol sol added a commit to sol/bundler that referenced this issue Nov 19, 2012
@sol sol Do not swallow --verbose on `bundle exec` (fixes #2102) 8b3d8fa
@indirect indirect closed this in efc387c Nov 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment