1
0
mirror of https://github.com/seejohnrun/haste-client.git synced 2025-12-12 23:05:56 +00:00

Avoid explosions (code a little different from PR)

Closes #11
This commit is contained in:
John Crepezzi
2013-03-16 20:39:20 -04:00
parent 98e72bce43
commit 6760a64957

View File

@@ -11,8 +11,9 @@ module Haste
# Pull all of the data from STDIN
def initialize
if STDIN.tty?
abort 'No input file given' unless ARGV.length == 1
abort "#{file}: No such path" unless File.exists?(file = ARGV[0])
file = ARGV.first
abort 'No input file given' unless file
abort "#{file}: No such path" unless File.exists?(file)
@input = open(file).read
else
@input = STDIN.readlines.join