On Sun, May 11, 2008 at 8:06 AM, Nobuyoshi Nakada <nobu / ruby-lang.org> wrote:
> Hi,
>
> At Sun, 11 May 2008 02:59:07 +0900,
> Joe Swatosh wrote in [ruby-talk:301402]:
> > I spent some time poking around in Config, but so far this is the the
> > only thing I've found that works:
>
> It depends on what you want to know.  If it is
>
> a) whether running with or without a console window, you can't
>   open "CONIN$" and "CONOUT$" without it.
>
>  begin
>    open("CONIN$") {}
>    # here is ruby
>  rescue
>    # here is rubyw
>  end
>
> b) whether running with opened STDIN/STDOUT/STDERR, STDIN.stat
>   and so on fail with EBADF if it is not opened.
>
> c) or, whether running executable is linked in GUI mode or CUI
>   mode, you might have to parse the exe header.  (imagehlp.dll
>   or something may be needed.)
>
> --
> Nobu Nakada
>
>

Thanks Sean.
I should have mentioned that testing for defined?, nil?, and eof?
weren't helpful.

Thanks Sebastian.
No joy on .tty? or .closed? either.

Nobu rocks again!
It is b)  We are using some gems that might puts or warn when they are
loaded, so when running under rubyw we are planning to redirect them
to a log file, but we don't want to mess with anything when running
under ruby.

Thanks again everyone.

--
Joe