Skip to content

Commit

Permalink
instead of hard setting stty, restore previous value
Browse files Browse the repository at this point in the history
  • Loading branch information
xsuchy committed Jun 25, 2012
1 parent 44bbee3 commit 039c665
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion puppet/bin/katello-configure
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ def _is_option_true(option_value)
end

def _read_password()
stty_orig_val = %x( stty -g )
system("stty -echo")
input = STDIN.gets
system("stty echo")
system("stty #{stty_orig_val}")
puts
return input
end
Expand Down
3 changes: 2 additions & 1 deletion puppet/bin/katello-passwd
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ elsif ARGV.count > 0
else
# query method
begin
stty_orig_val = %x( stty -g )
system "stty -echo"
print "Password: "; pass1 = $stdin.gets.chomp; puts "\n"
print "Password (repeat): "; pass2 = $stdin.gets.chomp; puts "\n"
Expand All @@ -92,6 +93,6 @@ else
exit 2
end
ensure
system "stty echo"
system("stty #{stty_orig_val}")
end
end

0 comments on commit 039c665

Please sign in to comment.