Please try again later."; showOutputPane(); return; } // Remove leading and trailing slashes if (hash !== undefined && hash.startsWith('/')) { hash = hash.substring(1); } if (hash !== undefined && hash.endsWith('/')) { hash = hash.substring(0, hash.length - 1); } // Hide output pane while executing const wrapper = document.getElementById('scrollable-output-pane'); wrapper.style.display = 'none'; // Show cogs document.getElementById('runwrapper').style.display = 'inline-block'; var path_hash = window.location.pathname; if (path_hash.endsWith('/')) { path_hash = path_hash.substring(0, path_hash.length - 1); } if (path_hash.endsWith('/run')) { path_hash = path_hash.substring(0, path_hash.length - 4); } var xhr = new XMLHttpRequest(); xhr.open("GET", "/compilerexplorer-run" + (hash !== undefined ? '/'+hash : path_hash), true); xhr.setRequestHeader('Content-Type', 'text/plain'); xhr.onreadystatechange = () => { if (xhr.readyState === 4) { var reply = "Invalid response
See browser console for details"; try { reply = JSON.parse(xhr.response); } catch (e) { hideCogs(); var output = document.getElementById('scrollable-output-pane-text'); output.innerHTML = "
";
output.innerHTML = output.innerHTML + "
";
output.innerHTML = output.innerHTML + reply;
showOutputPane();
console.log(e);
return;
}
try {
hideCogs();
var output = document.getElementById('scrollable-output-pane-text');
output.innerHTML = "
";
if (reply.zigbinCached) {
// cache = off
output.innerHTML = output.innerHTML + "cachedThe result is cached. Modify the source or add this comment ";
}
// Request error (from zigbin, not CE)
if (reply.error) {
output.innerHTML = output.innerHTML + " ";
}
if (reply.stdout && reply.stdout.length > 0) {
output.innerHTML = output.innerHTML + "stdout ";
reply.stdout.forEach((item) => {
output.innerHTML = output.innerHTML + escapeHtml(item.text) + " ";
reply.stderr.forEach((item) => {
output.innerHTML = output.innerHTML + escapeHtml(item.text) + " Exit code: " + reply.code;
showOutputPane();
}
catch (e) {
console.log(e)
}
}
}
xhr.send();
}
to always turn off caching:// cache = off
" + reply.error;
showOutputPane();
return;
}
// Compile error
else if (reply.code == -1) {
if (reply.buildResult) {
if (reply.buildResult.stderr[0].tag) {
document.getElementById('paste').setAttribute('data-line', reply.buildResult.stderr[0].tag.line);
Prism.highlightAll();
output.innerHTML = output.innerHTML + escapeHtml(reply.buildResult.stderr[0].tag.text);
} else {
output.innerHTML = output.innerHTML + escapeHtml(reply.buildResult.stderr[0].text);
}
output.innerHTML = output.innerHTML + "
";
reply.buildResult.stderr.forEach((item) => {
output.innerHTML = output.innerHTML + escapeHtml(item.text) + "
";
});
} else if (reply.stderr) {
output.innerHTML = output.innerHTML + "
";
reply.stderr.forEach((item) => {
output.innerHTML = output.innerHTML + escapeHtml(item.text) + "
";
});
} else {
output.innerHTML = output.innerHTML + "
";
output.innerHTML = "Unknown build error
";
}
// Run OK
} else {
if (reply.code == 143) {
output.innerHTML = output.innerHTML + "Process was terminated or output truncated
";
});
}
if (reply.stderr && reply.stderr.length > 0) {
output.innerHTML = output.innerHTML + "
stderr
";
});
}
if (reply.stdout && reply.stdout.length == 0 && reply.stderr && reply.stderr.length == 0) {
output.innerHTML = output.innerHTML + "Succeeded with no output";
}
}
output.innerHTML = output.innerHTML + "