Is there any way (on Windows) to detect if a script is running under rubyw.exe, i.e. headless?
Thanks,
Nathaniel
Terralien, Inc.
<:((><
Is there any way (on Windows) to detect if a script is running under rubyw.exe, i.e. headless?
Thanks,
Nathaniel
Terralien, Inc.
<:((><
Do you get an exception if you try puts? If so you could catch that.
On Wed, 17 Nov 2004 12:02:12 +0900, Nathaniel Talbott <nathaniel@talbott.ws> wrote:
Is there any way (on Windows) to detect if a script is running under
rubyw.exe, i.e. headless?Thanks,
Nathaniel
Terralien, Inc.<:((><
Hi,
At Wed, 17 Nov 2004 12:02:12 +0900,
Nathaniel Talbott wrote in [ruby-talk:120600]:
Is there any way (on Windows) to detect if a script is running under
rubyw.exe, i.e. headless?
Can you open "CONIN$" and "CONOUT$" device files?
--
Nobu Nakada
Nope, no exception, and STDOUT.closed? returns false. Any other ideas?
Nathaniel
Terralien, Inc.
<:((><
On Nov 16, 2004, at 22:22, Lyndon Samson wrote:
Do you get an exception if you try puts? If so you could catch that.
I don't know... how would I do that? I don't think I've ever opened a device file on Windows.
Nathaniel
Terralien, Inc.
<:((><
On Nov 17, 2004, at 09:48, nobu.nokada@softhome.net wrote:
At Wed, 17 Nov 2004 12:02:12 +0900,
Nathaniel Talbott wrote in [ruby-talk:120600]:Is there any way (on Windows) to detect if a script is running under
rubyw.exe, i.e. headless?Can you open "CONIN$" and "CONOUT$" device files?
Hi,
At Wed, 17 Nov 2004 23:57:52 +0900,
Nathaniel Talbott wrote in [ruby-talk:120639]:
>> Is there any way (on Windows) to detect if a script is running under
>> rubyw.exe, i.e. headless?
>
> Can you open "CONIN$" and "CONOUT$" device files?I don't know... how would I do that? I don't think I've ever opened a
device file on Windows.
Just open as well as ordinary files.
begin
open("CONIN$") {}
open("CONOUT$", "w") {}
have_console = true
rescue SystemCallError
have_console = false
end
--
Nobu Nakada
Excellent! Works great. Thanks a ton, Nobu.
Nathaniel
Terralien, Inc.
<:((><
On Nov 17, 2004, at 10:39, nobu.nokada@softhome.net wrote:
Nathaniel Talbott wrote in [ruby-talk:120639]:
Is there any way (on Windows) to detect if a script is running under
rubyw.exe, i.e. headless?Can you open "CONIN$" and "CONOUT$" device files?
I don't know... how would I do that? I don't think I've ever opened a
device file on Windows.Just open as well as ordinary files.
begin
open("CONIN$") {}
open("CONOUT$", "w") {}
have_console = true
rescue SystemCallError
have_console = false
end