On Sat, Apr 30, 2011 at 08:26,  <[email protected]> wrote:

> 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')

I assume that `:arg1 => 'key1'` is a placeholder for "you can pass
extra options here", and the overlap of name between the arguments to
the command and the argument to the function is coincidence, right?

> 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:

Actually, most users are happy parsing the output once it completes;
we don't drive interactive commands inside the agent – though, given
we can't, there may be latent demand hidden out in the field.

Generally speaking, I would consider that parsing the content
line-by-line to signify something a bit strange: the only advantages I
can think of compared to parsing the whole shebang at once are that
you can theoretically reduce peak memory use in the line-by-line case,
and that you can terminate early.

The later is always exciting, since it often triggers commands to exit
uncleanly...

> Does this sounds like a good approach?

I don't at all object to the approach, but I would like to understand
better *why* you think line-by-line parsing is useful.  I figure that
it presents you some advantage that I can't see from here, and since
you are pretty darn smart I would assume that is a shortfall in my
imagination. :)

Daniel

-- 
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.

Reply via email to