diff options
author | Abinoam P. Marques Jr <abinoam@gmail.com> | 2019-01-23 16:04:05 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-23 16:04:05 -0300 |
commit | ff972b56807cf2303404ec8b0de7084b5f9a8fe5 (patch) | |
tree | 75d5991ce37cad6568e6c93b72297ec0bc2e0aac | |
parent | bf489b632afd92c68df0b2c1f348afb66b5495aa (diff) | |
parent | 3896c9c37b9fa34be745e1bc1a66bb5eeffc998f (diff) | |
download | highline-2.0.1.tar.gz |
Merge pull request #238 from JEG2/issue_237v2.0.1
Fix #237 - TTY commands when no tty
-rw-r--r-- | .rubocop.yml | 3 | ||||
-rw-r--r-- | Changelog.md | 3 | ||||
-rw-r--r-- | lib/highline/terminal/io_console.rb | 11 | ||||
-rw-r--r-- | lib/highline/version.rb | 2 |
4 files changed, 14 insertions, 5 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 29b5448..c2da202 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,7 +4,7 @@ # https://github.com/bbatsov/rubocop/tree/master/config AllCops: - TargetRubyVersion: 1.9 + TargetRubyVersion: 2.1 # General @@ -50,7 +50,6 @@ Naming/MethodName: # SupportedStyles: when_needed, always, never Style/Encoding: Enabled: true - EnforcedStyle: always # If we fix this, it will change method signature. # Save it for major release. diff --git a/Changelog.md b/Changelog.md index c72b525..19a766f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,9 @@ Below is a complete listing of changes for each revision of HighLine. +### 2.0.1 / 2018-01-23 +* PR #238 / I #237 - Rescue Errno::ENOTTY when pipeing + ### 2.0.0 / 2018-06-10 * Release 2.0.0 (major version release). diff --git a/lib/highline/terminal/io_console.rb b/lib/highline/terminal/io_console.rb index e9ff925..d28ee0d 100644 --- a/lib/highline/terminal/io_console.rb +++ b/lib/highline/terminal/io_console.rb @@ -1,28 +1,35 @@ -# coding: utf-8 +# frozen_string_literal: true class HighLine class Terminal # io/console option for HighLine::Terminal. # It's the most used terminal. + # TODO: We're rescuing when not a terminal. + # We should make a more robust implementation. class IOConsole < Terminal # (see Terminal#terminal_size) def terminal_size output.winsize.reverse + rescue Errno::ENOTTY end # (see Terminal#raw_no_echo_mode) def raw_no_echo_mode input.echo = false + rescue Errno::ENOTTY end # (see Terminal#restore_mode) def restore_mode input.echo = true + rescue Errno::ENOTTY end # (see Terminal#get_character) - def get_character # rubocop:disable Naming/AccessorMethodName + def get_character input.getch # from ruby io/console + rescue Errno::ENOTTY + input.getc end end end diff --git a/lib/highline/version.rb b/lib/highline/version.rb index e677e4c..fdda6f5 100644 --- a/lib/highline/version.rb +++ b/lib/highline/version.rb @@ -2,5 +2,5 @@ class HighLine # The version of the installed library. - VERSION = "2.0.0".freeze + VERSION = "2.0.1".freeze end |