Skip to content

bundle config exits with successful exit status even when requested setting isn't set #3215

@jasonkarns

Description

@jasonkarns

bundle config SOME_SETTING is expected to print the value for the requested setting.

If the setting has a value, it is printed to STDOUT and exit status of 0 is returned as expected. If the requested setting is not set or has no value, it is expected that a non-zero exit status is returned. (as is conventional for cli programs) However, an exit status of 0 is returned in all cases.

This means that scripts and utilities that wish to interrogate bundler to find the value for a given setting have to parse the STDOUT of bundle config in order to determine if a particular setting is unset.

$ bundle config something
Settings for `something` in order of priority. The top value will be used
You have not configured a value for `something`
$ echo $?
0

Further, if any work is done on this, I would strongly request that the output from this command go to STDERR.

I would expect bundler config foo 2>/dev/null to print nothing but the final computed value of foo. All the rest of bundler's output (which is indeed super helpful), should go to STDERR as it is extraneous to the core role of bundle-config. And thus bundler config UNSET 2>/dev/null would print no output and exit non-zero.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions