-
Notifications
You must be signed in to change notification settings - Fork 74
Display version #188
Display version #188
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/false | ||
# This file should be source-d rather than exec-ed | ||
|
||
coloredtest=0 | ||
while : ; do | ||
case "$1" in | ||
--evaluatesh=*|--compilesh=*) | ||
case "$1" in | ||
--evaluatesh=debug|--compilesh=debug) | ||
export RUST_BACKTRACE=1 | ||
debugme=1 | ||
;; | ||
--evaluatesh=coloredtest) | ||
coloredtest=1 | ||
;; | ||
esac | ||
shift | ||
;; | ||
*) | ||
break | ||
esac | ||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import subprocess | ||
import re, os.path | ||
|
||
def execute(version, command, arguments, data=None): | ||
with subprocess.Popen(("playpen", | ||
"root-" + version, | ||
g_wrapper_cmd_cache = {} | ||
|
||
def execute(channel, command, arguments, data=None, skip_playpen=False, debug_me=False): | ||
cache_key = (channel, command) | ||
wrapper_cmd = g_wrapper_cmd_cache.get(cache_key, None) | ||
if wrapper_cmd is None: | ||
if skip_playpen: | ||
wrapper_cmd = () | ||
if os.path.exists(command): | ||
with open(command) as fp: | ||
if re.match(r'#!.*sh', fp.readline()): | ||
wrapper_cmd = ("sh", ) # compile.sh has non-standard #!/usr/bin/dash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't you rather change the shebang instead? Not sure if that's a good idea either, but it seems better than checking in here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure the Debian standard There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to wikipedia, Debian's /bin/sh is Dash, so you're running that anyway There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it is (I'm on Debian.) Arch is a weird distro. The tar binary package of Dash contains The quickest solution is changing the shebang to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Arch symlinks |
||
else: | ||
wrapper_cmd = ("playpen", | ||
"root-" + channel, | ||
"--mount-proc", | ||
"--user=rust", | ||
"--timeout=5", | ||
"--syscalls-file=whitelist", | ||
"--devices=/dev/urandom:r,/dev/null:rw", | ||
"--memory-limit=128", | ||
"--", | ||
command) + arguments, | ||
stdin=subprocess.PIPE, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.STDOUT) as p: | ||
"--") | ||
g_wrapper_cmd_cache[cache_key] = wrapper_cmd | ||
|
||
full_cmd = wrapper_cmd + (command, ) + arguments | ||
if debug_me: | ||
print("running {}".format(full_cmd), file=sys.stderr, flush=True) | ||
|
||
with subprocess.Popen(full_cmd, | ||
stdin=subprocess.PIPE, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.STDOUT) as p: | ||
if data is None: | ||
out = p.communicate()[0] | ||
else: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
(function () { | ||
"use strict"; | ||
|
||
window.g_versionDict = {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolon (fails Travis) |
||
|
||
// For convenience of development | ||
var PREFIX = location.href.indexOf("/web.html") != -1 ? "https://play.rust-lang.org/" : "/"; | ||
|
||
|
@@ -205,7 +207,9 @@ | |
req.open(method, url, true); | ||
req.onreadystatechange = function() { | ||
if (req.readyState == XMLHttpRequest.DONE) { | ||
if (req.status == expect) { | ||
var ok = Array.isArray(expect) ? expect.includes(req.status) : | ||
req.status == expect; | ||
if (ok) { | ||
if (on_success) { | ||
on_success(req.responseText); | ||
} | ||
|
@@ -558,6 +562,40 @@ | |
session = editor.getSession(); | ||
themelist = ace.require("ace/ext/themelist"); | ||
|
||
var rustVerDisplay = document.getElementById('rustc-version-text'); | ||
if (rustVerDisplay) { | ||
httpRequest("GET", "/version.json", null, [200, 304], | ||
function(response) { | ||
window.g_versionDict = JSON.parse(response); | ||
for (var channel in window.g_versionDict) { | ||
if ( ! window.g_versionDict.hasOwnProperty(channel)) continue; | ||
var rustver = window.g_versionDict[channel].rustc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another missing semicolon |
||
|
||
var label = document.getElementById('label-' + channel); | ||
if (label) { | ||
var t = label.title; | ||
if (t) { | ||
label.title = t + ": " + rustver; | ||
} | ||
} | ||
|
||
var button = document.getElementById('version-' + channel); | ||
if (button) { | ||
button.onclick = (function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Don't make functions within a loop" apparently also fails Travis |
||
var rv = rustver; | ||
return function() { | ||
rustVerDisplay.textContent = rv; | ||
}; | ||
})(); | ||
if (button.checked) | ||
button.onclick(); | ||
} | ||
} | ||
}, function(status, response) { | ||
rustVerDisplay.textContent = "Could not fetch rustc version"; | ||
}); | ||
} | ||
|
||
editor.focus(); | ||
|
||
build_themes(themelist); | ||
|
@@ -665,7 +703,7 @@ | |
}; | ||
|
||
mirButton.onclick = function() { | ||
document.getElementById("version-nightly").checked = true; | ||
document.getElementById("version-nightly").onclick(); | ||
compile("mir", result, session.getValue(), getRadioValue("version"), | ||
getRadioValue("optimize"), mirButton); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh and the backtrace thing would be #119, so it should probably be solved in a different way (such as a check box on the website - but that can wait for another PR, too)