diff --git a/lib/youplot/command.rb b/lib/youplot/command.rb index 9e3b3f7..a7d090c 100644 --- a/lib/youplot/command.rb +++ b/lib/youplot/command.rb @@ -81,9 +81,15 @@ module YouPlot # normal mode else # Sometimes the input file does not end with a newline code. - while (input = Kernel.gets(nil)) + begin + begin + input = Kernel.gets(nil) + rescue Errno::ENOENT => e + warn e.message + next + end main(input) - end + end until input end end @@ -155,6 +161,10 @@ module YouPlot warn 'Please try to set the correct character encoding with --encoding option.' warn e.backtrace.grep(/youplot/).first exit 1 + rescue ArgumentError => e + warn 'Failed to parse the text. ' + warn e.backtrace.grep(/youplot/).first + exit 1 end data