How to capture stderr while using backtick?

Ruby Gurus,

I am using backticks in my ruby script to run DOS
commands, but cannot figure out how to separate the
stdin from stderr.

Please see transcript below for what I am trying to
do:

-------------- begin transcript -------------
C:>dir z
Volume in drive C is LOCAL
Volume Serial Number is AC53-D8CC

Directory of C:\

File Not Found

C:>ruby -ve 'puts dir z
ruby 1.7.2 (2002-06-03) [i386-mswin32]
File Not Found
Volume in drive C is LOCAL
Volume Serial Number is AC53-D8CC

Directory of C:
----------- end transcript -----------------

Notice how, when I use Ruby, the stderr message “File
Not Found” shows up first and then stdin msgs.

How do I separate the two streams?

TIA,
– Shanko

···

Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

Hi,

“Shashank Date” shanko_date@yahoo.com wrote in message
news:20020903214306.16461.qmail@web12306.mail.yahoo.com

Ruby Gurus,

I am using backticks in my ruby script to run DOS
commands, but cannot figure out how to separate the
stdin from stderr.

Please see transcript below for what I am trying to
do:

-------------- begin transcript -------------
C:>dir z
Volume in drive C is LOCAL
Volume Serial Number is AC53-D8CC

Directory of C:\

File Not Found

C:>ruby -ve ‘puts dir z
ruby 1.7.2 (2002-06-03) [i386-mswin32]
File Not Found
Volume in drive C is LOCAL
Volume Serial Number is AC53-D8CC

Directory of C:
----------- end transcript -----------------

Notice how, when I use Ruby, the stderr message “File
Not Found” shows up first and then stdin msgs.

How do I separate the two streams?

TIA,
– Shanko

Refer to Make Your Own Quiz, List or Poll | RubyTalk

Park Heesob

Thanks Park.
I was hoping that there would be some easy way to capture it in a string
variable… oh well !

“Park Heesob” phasis@kornet.net wrote in message
news:al55c4$hte$1@news1.kornet.net

···

Hi,

“Shashank Date” shanko_date@yahoo.com wrote in message
news:20020903214306.16461.qmail@web12306.mail.yahoo.com

Ruby Gurus,

I am using backticks in my ruby script to run DOS
commands, but cannot figure out how to separate the
stdin from stderr.

Please see transcript below for what I am trying to
do:

-------------- begin transcript -------------
C:>dir z
Volume in drive C is LOCAL
Volume Serial Number is AC53-D8CC

Directory of C:\

File Not Found

C:>ruby -ve ‘puts dir z
ruby 1.7.2 (2002-06-03) [i386-mswin32]
File Not Found
Volume in drive C is LOCAL
Volume Serial Number is AC53-D8CC

Directory of C:
----------- end transcript -----------------

Notice how, when I use Ruby, the stderr message “File
Not Found” shows up first and then stdin msgs.

How do I separate the two streams?

TIA,
– Shanko

Refer to Make Your Own Quiz, List or Poll | RubyTalk

Park Heesob