Improve entry of username and password for scp upload.

This commit is contained in:
Luke Taylor 2010-09-24 21:01:18 +01:00
parent 685e0417a7
commit f978814bb1
1 changed files with 6 additions and 5 deletions

View File

@ -64,11 +64,12 @@ class Login extends DefaultTask {
@TaskAction @TaskAction
login() { login() {
project.ant { def console = System.console()
input("Please enter the ssh username for host '$host'", addproperty: "user.$host") if (console) {
input("Please enter the ssh password '$host'", addproperty: "pass.$host") username = console.readLine("\nPlease enter the ssh username for host '$host': ")
} password = new String(console.readPassword("Please enter the ssh password for '$host': "))
username = ant.properties["user.$host"] } else {
password = ant.properties["pass.$host"] logger.error "Unable to access System.console()."
}
} }
} }