From: Nathaniel Talbott Date: 2004-11-18T00:47:55+09:00 Subject: Re: Detecting rubyw 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 Excellent! Works great. Thanks a ton, Nobu. Nathaniel Terralien, Inc. <:((><