Skip to content

Commit 1c2097e

Browse files
committed
delay on initial command run
1 parent 0b34446 commit 1c2097e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

public/javascripts/occ_editor.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,18 @@
804804
};
805805

806806
occEditor.open_terminal = function(path, command) {
807+
function run_command(command, delay) {
808+
console.log("sending command: " + command);
809+
setTimeout(function () {
810+
occEditor.send_terminal_command(command);
811+
}, delay);
812+
}
813+
814+
if (is_terminal_open) {
815+
run_command(command, 0);
816+
return;
817+
}
818+
807819
Terminal.applyAddon(fit);
808820
Terminal.applyAddon(attach);
809821

@@ -814,12 +826,6 @@
814826

815827
var terminalContainer = document.getElementById('editor-output');//,
816828

817-
function run_command(command) {
818-
console.log("sending command: " + command);
819-
term.send(JSON.stringify({type: "input", data: command}));
820-
//occEditor.send_terminal_command(command);
821-
}
822-
823829
// Clean terminal
824830
while (terminalContainer.children.length) {
825831
terminalContainer.removeChild(terminalContainer.children[0]);
@@ -856,7 +862,7 @@
856862
occEditor.show_editor_output();
857863

858864
if (command) {
859-
terminal_socket.onopen = run_command.bind(null, command);
865+
terminal_socket.onopen = run_command.bind(null, command, 1500);
860866
}
861867
});
862868
}, 0);

0 commit comments

Comments
 (0)