Merge pull request #450 from Zengor/master

Call playground with /execute
This commit is contained in:
Mathieu David 2017-09-23 21:35:41 +02:00 committed by GitHub
commit a6d4881e00
1 changed files with 11 additions and 9 deletions

View File

@ -358,22 +358,24 @@ function run_rust_code(code_block) {
result_block = code_block.find(".result");
}
let text = playpen_text(code_block);;
let text = playpen_text(code_block);
var params = {
version: "stable",
optimize: "0",
channel: "stable",
mode: "debug",
crateType: "bin",
tests: false,
code: text,
};
}
if(text.indexOf("#![feature") !== -1) {
params.version = "nightly";
params.channel = "nightly";
}
result_block.text("Running...");
$.ajax({
url: "https://play.rust-lang.org/evaluate.json",
url: "https://play.rust-lang.org/execute",
method: "POST",
crossDomain: true,
dataType: "json",
@ -381,7 +383,7 @@ function run_rust_code(code_block) {
data: JSON.stringify(params),
timeout: 15000,
success: function(response){
result_block.text(response.result);
result_block.text(response.success ? response.stdout : response.stderr);
},
error: function(qXHR, textStatus, errorThrown){
result_block.text("Playground communication " + textStatus);