diff options
author | David Barksdale <amatus@amatus.name> | 2017-01-14 14:18:34 -0600 |
---|---|---|
committer | David Barksdale <amatus@amatus.name> | 2017-01-14 14:18:34 -0600 |
commit | 48f423ca49aa62a8aa9928d3085ce89032703ff2 (patch) | |
tree | 53e8511cc764b9c0a171997cc91b0d38d1ac1800 | |
parent | c5f448de6bbbdd222159d8d16473bfe25d511606 (diff) |
Handle boot prompt
-rw-r--r-- | src/app/portmaster.clj | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/app/portmaster.clj b/src/app/portmaster.clj index a1fec0c..1387750 100644 --- a/src/app/portmaster.clj +++ b/src/app/portmaster.clj @@ -25,7 +25,9 @@ (withTimeout 1 TimeUnit/MILLISECONDS) (expect the-unexpected)) (catch Exception e)) - (let [matchers (into-array [(Matchers/contains "Username:") prompt]) + (let [matchers (into-array [(Matchers/contains "Username:") + (Matchers/contains "Enter choice (1 or 2):") + prompt]) results (.getResults (.. expect (withTimeout 100 TimeUnit/MILLISECONDS) (sendLine) @@ -36,7 +38,13 @@ (expect (Matchers/contains "Password:"))) (.. expect (sendLine password) - (expect prompt))))) + (expect prompt))) + (when (.isSuccessful (second results)) + (.. expect + (withTimeout 5000 TimeUnit/MILLISECONDS) + (sendLine "2") + (expect (Matchers/contains "Username:"))) + (login-maybe expect username password)))) (defn do-command ([expect command] |