Commit d1653c16 authored by Jakob Moser's avatar Jakob Moser
Browse files

Make runCommand async

parent 9d126a46
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ export function onEnterPressed(handler) {
 * The command will then be executed, and the output will be shown in the terminal
 * @param {string} command A command to execute
 */
export function runCommand(command) {
export async function runCommand(command) {
    const textarea = document.querySelector(".term_textarea")
    // We append \n to simulate the Enter press
    textarea.value = command + "\n"
@@ -156,6 +156,8 @@ export function runCommand(command) {
    // Now we just have to trigger an input event to activate the JSLinux event handler, see
    // https://thewebdev.info/2021/05/02/how-to-programmatically-trigger-a-change-event-on-an-input-with-javascript/
    textarea.dispatchEvent(new Event("input"))

    // TODO Wait until a prompt is shown
}

/**