Skip to content

(maint) Return the empty string on exec error#640

Merged
peterhuene merged 1 commit intopuppetlabs:facter-2from
adrienthebo:maint/facter-2/solaris-uptime-error
Feb 14, 2014
Merged

(maint) Return the empty string on exec error#640
peterhuene merged 1 commit intopuppetlabs:facter-2from
adrienthebo:maint/facter-2/solaris-uptime-error

Conversation

@adrienthebo
Copy link

Commit 8a14998 removed most of the special casing around executing
commands and changed calling code to always assume that .exec would
return a string. However the error cases in .exec would still return
nil which would break this assumption.

This commit updates .exec to return the empty string on error. It's
somewhat questionable to do this but if we want to fail hard on errors
we should raise an exception instead of returning nil.

Commit 8a14998 removed most of the special casing around executing
commands and changed calling code to always assume that .exec would
return a string. However the error cases in .exec would still return
nil which would break this assumption.

This commit updates .exec to return the empty string on error. It's
somewhat questionable to do this but if we want to fail hard on errors
we should raise an exception instead of returning nil.
peterhuene added a commit that referenced this pull request Feb 14, 2014
…e-error

(maint) Return the empty string on exec error
@peterhuene peterhuene merged commit 4694c49 into puppetlabs:facter-2 Feb 14, 2014
@adrienthebo adrienthebo deleted the maint/facter-2/solaris-uptime-error branch February 14, 2014 20:27
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.

2 participants