lib/hammer_cli/shell.rb in hammer_cli-3.2.0 vs lib/hammer_cli/shell.rb in hammer_cli-3.3.0
- old
+ new
@@ -84,11 +84,11 @@
Readline.completion_append_character = ''
Readline.completer_word_break_characters = ' ='
Readline.completion_proc = complete_proc
- stty_save = `stty -g`.chomp
+ stty_save = `stty -g`.chomp if $stdin.tty?
history = ShellHistory.new(Settings.get(:ui, :history_file) || DEFAULT_HISTORY_FILE)
begin
print_welcome_message
@@ -100,10 +100,11 @@
ShellMainCommand.run('hammer', line, context) unless line.empty?
end
rescue Interrupt; end
puts
- system('stty', stty_save) # Restore
+ # Restore
+ system('stty', stty_save) if $stdin.tty?
HammerCLI::EX_OK
end
private