on waitForResponse(sessionToWatch, expectedText)
        set myTextObject to text of sessionToWatch
        log myTextObject
end waitForResponse

tell application "iTerm2"
        set aSession to current session of current window
        my waitForResponse(aSession, "foo")
end tell

