Commit 34cddd47 authored by Jakob Moser's avatar Jakob Moser
Browse files

Fix bug in and improve checking mechanism

parent 5b6946cc
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -141,14 +141,18 @@ export function getTerminalContents(includeLastInteraction) {
 */
function prompt() {
    return new Promise((resolve)=>{
        const intervalId = setInterval(()=>{
        const intervalId = setInterval(checkAndResolve, 100)
    
        function checkAndResolve() {
            const lastInteraction = getTerminalContents(true).at(-1)

            if(lastInteraction.prompt && !lastInteraction.input) {
            if(lastInteraction.prompt && !lastInteraction.input.trim()) {
                clearInterval(intervalId)
                resolve(prompt)
            }
        }, 200)
        }

        checkAndResolve()
    })
}