question: private void waitForInitialPrompt ( Pattern initialPromptPattern ) throws IOException { String prompt = waitFor ( initialPromptPattern ) ; String output = getCurrentStandardOutContents ( ) ; int index = StringUtils . indexOf ( output , prompt ) + prompt . length ( ) ; initialPrompt = StringUtils . substring ( output , 0 , index ) ; if ( StringUtils . contains ( initialPrompt , '\n' ) ) { initialPrompt = StringUtils . substringAfterLast ( initialPrompt , "\n" ) ; } debug ( "Found initial prompt: '%s'" , initialPrompt ) ; promptPattern = Pattern . compile ( Pattern . quote ( initialPrompt ) ) ; stdoutPos = index ; }
target:  Waits for the first prompt.