Skip to content

Commit d86b3dd

Browse files
committed
Add time limit to Skulpt
1 parent 9e127e0 commit d86b3dd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

assets/js/code-editor.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ var current_inp = 0;
1414

1515
function get_input(prompt) {
1616
return new Promise((resolve, reject) => {
17-
let input = document.getElementById('input-tmp').value.split(/\r?\n/);
17+
let input = document.getElementById('input-tmp').value.trim().split(/\r?\n/);
1818
if (input[0] == '') {
1919
input = [];
2020
}
21-
console.log(input, current_inp)
2221
if (current_inp >= input.length) {
2322
throw "Place your input(s) in the \"input\" box!";
2423
}
@@ -33,7 +32,7 @@ function runit() {
3332
var output_element = document.getElementById("output");
3433
output_element.innerText = '';
3534
Sk.pre = "output";
36-
Sk.configure({ output: outf, inputfun: get_input, inputfunTakesPrompt: true });
35+
Sk.configure({ output: outf, inputfun: get_input, inputfunTakesPrompt: true, execLimit: 1000 });
3736
var myPromise = Sk.misceval.asyncToPromise(function () {
3837
return Sk.importMainWithBody("<stdin>", false, prog, true);
3938
});

0 commit comments

Comments
 (0)