From e7a4cfda313132a718ddbca8aa27cba50ed6bb96 Mon Sep 17 00:00:00 2001 From: mingers Date: Fri, 11 Jul 2014 11:21:31 +1000 Subject: [PATCH 1/2] Updated stty session state save to check for an interactive terminal - this prevents stty throwing errors in the output when run in a non-interactive session. --- lib/rye/box.rb | 2 +- lib/rye/hop.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rye/box.rb b/lib/rye/box.rb index 4475753..d6449ac 100644 --- a/lib/rye/box.rb +++ b/lib/rye/box.rb @@ -155,7 +155,7 @@ def initialize(host='localhost', opts={}) @rye_password_prompt = @rye_opts.delete(:password_prompt) # Store the state of the terminal - @rye_stty_save = `stty -g`.chomp rescue nil + @rye_stty_save = `stty -g`.chomp if STDIN.tty? unless @rye_templates.nil? require @rye_templates.to_s # should be :erb diff --git a/lib/rye/hop.rb b/lib/rye/hop.rb index c891e0d..44c400d 100644 --- a/lib/rye/hop.rb +++ b/lib/rye/hop.rb @@ -123,7 +123,7 @@ def initialize(host, opts={}) @rye_templates = @rye_opts.delete(:templates) # Store the state of the terminal - @rye_stty_save = `stty -g`.chomp rescue nil + @rye_stty_save = `stty -g`.chomp if STDIN.tty? unless @rye_templates.nil? require @rye_templates.to_s # should be :erb From 489e69c00f71ec5f7d9497e28a3a219ac6721ae6 Mon Sep 17 00:00:00 2001 From: mingers Date: Fri, 11 Jul 2014 15:37:57 +1000 Subject: [PATCH 2/2] added rescue condition to stty session save --- lib/rye/box.rb | 4 ++-- lib/rye/hop.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rye/box.rb b/lib/rye/box.rb index d6449ac..c4f457b 100644 --- a/lib/rye/box.rb +++ b/lib/rye/box.rb @@ -155,8 +155,8 @@ def initialize(host='localhost', opts={}) @rye_password_prompt = @rye_opts.delete(:password_prompt) # Store the state of the terminal - @rye_stty_save = `stty -g`.chomp if STDIN.tty? - + @rye_stty_save = `stty -g`.chomp if STDIN.tty? rescue nil + unless @rye_templates.nil? require @rye_templates.to_s # should be :erb end diff --git a/lib/rye/hop.rb b/lib/rye/hop.rb index 44c400d..507d0b6 100644 --- a/lib/rye/hop.rb +++ b/lib/rye/hop.rb @@ -123,7 +123,7 @@ def initialize(host, opts={}) @rye_templates = @rye_opts.delete(:templates) # Store the state of the terminal - @rye_stty_save = `stty -g`.chomp if STDIN.tty? + @rye_stty_save = `stty -g`.chomp if STDIN.tty? rescue nil unless @rye_templates.nil? require @rye_templates.to_s # should be :erb