    function sleep(ms) {
          return new Promise(resolve => setTimeout(resolve, ms));
        }

        Terminal.loadAddon('fit');
        var term = new Terminal({cursorBlink: false, rows: 12});
        term.open(document.getElementById('terminal'));

        async function termclear() {
            term.destroy();
            await sleep(100);
            term = new Terminal({cursorBlink: false, rows: 12});
            term.open(document.getElementById('terminal'));
        };

        function term