Robert Klemme wrote in post #1026400:
> On Thu, Oct 13, 2011 at 8:22 AM, Marc Heiler <shevegen / linuxmail.org>
> wrote:
>>
>> Question 1:
>>
>> I don't seem to get the output of this command, when it is done
>> like the above way.
>
> What exactly do you mean by that?  Do you expect the output in result
> or on the terminal?
>
>> For instance, an error could be like this here:
>>
>> No package 'gtk+-3.0' found
>>
>> I could grep the whole string for something like that.
>>
>> But perhaps there is another way? An error result that is
>> set and which I could use in Ruby?
>>
>> Any pointers appreciated!
>
> I suggest to look at popen and variants which give you more control
> about the child process
>
> http://rdoc.info/stdlib/core/1.9.2/IO#popen-class_method
> http://rdoc.info/stdlib/open3/1.9.2/Open3#popen3-instance_method


FWIW, I use 1.9's open3 lib in a custom git cmd to slurp combined
stdout/stderr and get the return code

https://gist.github.com/1245318#file_gitall.rb

And it appears to work OK with MRI on Windows ;)


Jon

---
blog: http://jonforums.github.com/
twitter: @jonforums

Most people die of a sort of creeping common sense, and discover when it
is too late that the only things one never regrets are one's mistakes.
                                                           - Oscar Wilde

-- 
Posted via http://www.ruby-forum.com/.