Issue #2538 has been updated by Stefan Schulte.
I'm currently refactoring execute to use pipes instead of temporary files to
capture stdout and stderr of the external command. This also allows me to
capture the output "live" while the programm is still running.
I would also like to change the interface of execute so you can call execute
like this if you just care about the returncode:
returncode = execute(['/bin/prog','arg1','arg2'], :arg1 => 'key1')
If you are interested in the actual output I guess that's most likely the case
because you want to parse the output line by line. In that case execute could
be used like this:
returncode = execute(['/bin/prog','arg1','arg2'], :arg1 => 'key1') do
|stream, line|
if stream == :out
parse_line(line)
else # stream == :err
Puppet.warning("Warning while parsing output of prog: #{line}")
end
end
Does this sounds like a good approach?
----------------------------------------
Feature #2538: Puppet::Util.execute should offer a way to get the exit status
of the command.
https://projects.puppetlabs.com/issues/2538
Author: Nigel Kersten
Status: Accepted
Priority: High
Assignee:
Category: plumbing
Target version: Telly
Affected Puppet version:
Keywords:
Branch:
Puppet::Util.execute should offer a way to get the exit status of the command.
We shouldn't have to use system() and $?.exitstatus.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.