Commit 33fb7709404e706801683e6c47ab7a0a5a1884b1

Avatar

Repository git://github.com/reductivelabs/facter.git master
by duritong (Using name ‘Peter Meier’) on 2009-11-07 11:10 (23 days ago)

use popen3 in Resolution.exec to catch stderr
So far messages to stderr haven't been catched by
Facter::Util::Resolution.exec and were insted printed out to
stderr. This will cause facter and even puppet to print to stderr
themself, which is not very nice when running puppetd by cron,
as you might get every run a mail if a command outputs to stderr.

We are now wrapping the command execution with Open3.popen3 to
catch stderr and passing them to the new introduced Facter.warn
method.

We are also catching multiline outputs chomping newlines and
returning an array if there have been more than one line. Otherwise
we return an array containing the different lines.

This prevents in general cases as described in #2766 and should
handle command execution in a bit saner way.

Language Totals

  Language Code Added Code Removed Comments Added Comments Removed Blanks Added Blanks Removed
  Ruby 48 5 0 0 12 0

Files Changed

[2 total ]
File Language Code Added Code Removed Comments Added Comments Removed Blanks Added Blanks Removed
lib/facter/util/resolution.rb
  Ruby 14 5 0 0 2 0
spec/unit/util/resolution.rb
  Ruby 34 0 0 0 10 0