Skip to content

Instantly share code, notes, and snippets.

@jodell
Created April 13, 2010 02:58
Show Gist options
  • Save jodell/364265 to your computer and use it in GitHub Desktop.
Save jodell/364265 to your computer and use it in GitHub Desktop.
require 'fcntl'
# http://blog.footle.org/2008/08/21/checking-for-stdin-inruby/
@stdin = STDIN.read if STDIN.fcntl(Fcntl::F_GETFL, 0) == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment