From 48f423ca49aa62a8aa9928d3085ce89032703ff2 Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Sat, 14 Jan 2017 14:18:34 -0600 Subject: Handle boot prompt --- src/app/portmaster.clj | 12 ++++++++++-- 1 file 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] -- cgit v1.2.3-18-g5258