On 2/23/07, [email protected] [email protected] wrote:
hrrrm. this is a windozing type thing, but is it perhaps manipulating the
console directly? for instance, in unix, this can happen.
I believe that the underlying executable that I’m dealing with, namely
VC8’s “link.exe” is doing something very dastardly.
STDOUT.reopen tmp.path
STDERR.reopen tmp.path
exec cmd
When I integrate the above code, a tempfile is indeed created, but it
remains empty. And what’s more? I still see the output in the
console! (:
However, the following irb session indeed proves that stdout can be
redirected. (as well as makes me laugh out loud)
irb(main):001:0> require ‘tempfile’
=> true
irb(main):002:0> tmp = Tempfile.new Process.pid
=> #<File:C:/DOCUME~1/Harold/LOCALS~1/Temp/484.484.0>
irb(main):003:0> STDOUT.reopen tmp.path
…
#hrhrhr.
@io << "#{ @prefix }: #{ line }"
stdout: 42
stderr: 42
This code is also awesome, but when I integrate it into my tool, it
has literally no effect on the outcome.
All of this is leading me to believe that VC8’s link.exe (or as I’ve
renamed it ‘old-Link.exe’) is doing something very tricky, not
involving stdout or stderr at all.
Moreover, I’ve exceeded the point where solving this problem will save
me time versus watching 200k of spewed linker warnings with each build
of my software. (of course due to a 3rd party library that wont give
me their .pdb files, and a bug in VC8 which causes /IGNORE: to be
itself ignored on the command line of the linker.)
Oh well, thanks again for the lessons, I know more about spawning
processes from Ruby on Windows than I ever thought I would.
Regards,
-Harold