From: Shannon Fang Date: 2005-10-27T15:44:54+09:00 Subject: Detection of redirection, possible? Hi All, How can I detect a ruby program's stdio has been redirected? I would like to do this: puts "show message to user" $stdin.gets unless $stdin.redirected? This way, if the program runs normally, it show message and wait for user interaction, if it is redirected to a file, then just puts to that file without wating for user intervention. Thanks! Shannon