X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=lib%2FUtils.pm;h=29e020cb843a340d502895c900d4be1258128fd3;hb=65420197aa633c6aabfec834730c7e87c93649cf;hp=eddef3aa1995f32a581bf0bd913f0d0e5909875a;hpb=bdb1e0c845a6921e22d52fbff3404d5c1dfae520;p=clearscm.git diff --git a/lib/Utils.pm b/lib/Utils.pm index eddef3a..29e020c 100644 --- a/lib/Utils.pm +++ b/lib/Utils.pm @@ -341,10 +341,9 @@ Returns: =cut - $prompt ||= 'Password'; - my $password; + my $password = ''; local $| = 1; @@ -365,9 +364,18 @@ Returns: last; } # if - print '*'; + # Handle backspaces + if ($key eq chr(127)) { + unless ($password eq '') { + chop $password; + + print "\b \b"; + } # unless + } else { + print '*'; - $password .= $key; + $password .= $key; + } # if } # while ReadMode 'restore'; # Reset tty mode before exiting. @@ -578,7 +586,7 @@ Returns: =cut - open my $pipe, '|-', $to + open my $pipe, '|', $to or error "Unable to open pipe - $!", 1; foreach (@output) {