Stderr capture on Windows

Is it possible to capture stderr on Windows?

Backtick seems to ignore it, and

require “open3”
stdin, stdout, stderr = Open3.popen3(‘dir’)

gives me

“the fork() function is unimplemented on this machine
(NotImplementedError)”

Sard A. wrote:

Is it possible to capture stderr on Windows?

Backtick seems to ignore it, and

require “open3”
stdin, stdout, stderr = Open3.popen3(‘dir’)

gives me

“the fork() function is unimplemented on this machine
(NotImplementedError)”

See solution here
http://blog.pomozov.info/posts/capturing-stderr-on-ruby.html

Anatol P. wrote:

See solution here
http://blog.pomozov.info/posts/capturing-stderr-on-ruby.html

Well that gives me another cryptic error

“The handle could not be duplicated during redirection of handle 1” :smiley:

Anatol P. wrote:

puts dir 2>&1

what do you see?

If everything is OK then problem in you main script. Try to check that
you do not copy or replace STDOUT.

Yes it was my script that works now.

Thanks for the help.

From: “Sard A.” [email protected]

“the fork() function is unimplemented on this machine
(NotImplementedError)”

http://popen4.rubyforge.org/

or

gem install POpen4

It should present several possible versions to install. If your
windows ruby was installed using the 1.8.4 one-click installer,
you probably want the “win32-1.8.4-VC6” version.

Regards,

Bill

Sard A. wrote:

Anatol P. wrote:

See solution here
http://blog.pomozov.info/posts/capturing-stderr-on-ruby.html

Well that gives me another cryptic error

“The handle could not be duplicated during redirection of handle 1” :smiley:

Try to put following line to separate script and run

puts dir 2>&1

what do you see?

If everything is OK then problem in you main script. Try to check that
you do not copy or replace STDOUT.