Verified Commit 30395ed7 authored by Jakob Moser's avatar Jakob Moser
Browse files

Try exiting Vi

See #78
parent 16cc2777
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -193,10 +193,20 @@ class ExerciseExecutionContext {
            function tryPrepareAndResolve() {
                if(getTerminalContents().length === 0 && !isVmLoading()) {
                    // We don't have a prompt, and the VM doesn't appear to be loading.
                    // So maybe the user has opened an editor or a pager. Let's try to get out of this.
                    // So maybe the user has opened a pager. Let's try to get out of this, using Ctrl+C.
                    abort()
                }

                if(getTerminalContents().length === 0 && !isVmLoading()) {
                    // If there is still no prompt, and just like before, the VM isn't loading,
                    // Ctrl+C apparently didn't work to exit whatever we were in.

                    // So we are probably in Vi.

                    // Try exiting that.
                    runCommand(":q!")
                }

                if (getTerminalContents().length > 0) {
                    // We have a prompt, so we can prepare and resolve.
                    clearInterval(intervalId)