diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-07-08 16:48:49 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-07-08 16:48:49 +0100 |
commit | 30f4284b663ea18c421ed754a1d2102712b6fee0 (patch) | |
tree | 0a69de97fa3921bc5c9b805e58b10c92d91ce312 | |
parent | 5131cb250acb2c458e4be42f4c1187fdac76fe26 (diff) | |
download | prosody-30f4284b663ea18c421ed754a1d2102712b6fee0.tar.gz prosody-30f4284b663ea18c421ed754a1d2102712b6fee0.zip |
prosodyctl: Don't 'blugh' when ^C is pressed during reading passwords
-rwxr-xr-x | prosodyctl | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -125,17 +125,21 @@ end local function getchar(n) os.execute("stty raw -echo"); - local char = io.read(n or 1); + local ok, char = pcall(io.read, n or 1); os.execute("stty sane"); - return char; + if ok then + return char; + end end local function getpass() os.execute("stty -echo"); - local pass = io.read("*l"); + local ok, pass = pcall(io.read, "*l"); os.execute("stty sane"); io.write("\n"); - return pass; + if ok then + return pass; + end end function show_yesno(prompt) |