Thanks, Alex. And you, too, "gwtmp01".
Cripes. I never knew about "2>"! That's
the easiest solution, in this case.
I appreciate the additional information,
as well. They give me some alternatives
to examine.
You guys saved the day! Thanks much.
Alex Young wrote:
> Eric Armstrong wrote:
>> My rakefile needs to abort when an html
>> file can't be parsed into REXML, so I
>> can report the error and fix it. But...
>>
>> Running tidy in a subshell, I can find
>> no way to access the error message it
>> sends to std error. I can see it, but
>> is there a way to get ruby to see it?
> You can:
>
> - Use open3, which gives you access to stderr.
> (http://ruby-doc.org/stdlib/libdoc/open3/rdoc/index.html)
>
> - Use ruby-tidy, which wraps the tidy library and gives you exceptions
> when things go wrong. (http://rubyforge.org/projects/tidy)
>
> - Redirect stderr in your shell command. ("tidy ... > file 2> errors")
>
> I've used the second method quite successfully. It's dead simple, but
> you've got to be careful about different Ruby threads using the library.
> It's quite easy to make it go pop unless you wrap it in a critical
> section.
>