Skip to content

Instantly share code, notes, and snippets.

@axgle
Created November 11, 2009 05:22
Show Gist options
  • Save axgle/231698 to your computer and use it in GitHub Desktop.
Save axgle/231698 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Prints if the input or output is regular or piped
puts "INPUT: #{STDIN.tty? ? "regular" : "pipe"}"
puts "OUTPUT: #{STDOUT.tty? ? "regular" : "pipe"}"
#http://blog.bogojoker.com/2009/04/check-if-your-ruby-script-is-in-a-pipe/
==
ruby -e 'puts $stdin.tty?' < rakefile.rb
false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment