S
Shannon Fang
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
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