Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Set LANG to en_US.UTF-8 in Haskell sandbox for mueval

  • Loading branch information...
commit 4f815f606dce9e81ef9965d4a244c4cf46fe5d76 1 parent 9b324e0
@dsamarin dsamarin authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/sandbox/index.js
View
13 lib/sandbox/index.js
@@ -90,17 +90,18 @@ Sandbox.prototype.run = function(engine, timeout, code, hollaback, object) {
};
Sandbox.prototype.runHaskell = function (timeout, code, hollaback, object) {
- var stdout = []
+ var stdout = ""
+ , env = Object.create (process.env, {LANG: {value: "en_US.UTF-8", enumerable: true, writable: true, configurable: true}})
, child = Spawn ("mueval",
- ["--inferred-type", "--time-limit=" + (timeout/1000|0)
+ ["--inferred-type", "--time-limit=" + Math.round(timeout / 1000)
,"--no-imports", "--load-file=" + Path.join (__dirname, "hs", "Environment.hs")
- ,"--Extensions", "-e", code]);
+ ,"--Extensions", "-e", code], {env: env});
- child.stdout.on ("data", function (data) { if (data) stdout.push (data) });
- child.stderr.on ("data", function (data) { if (data) stdout.push (data) }); // 2>&1
+ child.stdout.on ("data", function (data) { if (data) stdout += data });
+ child.stderr.on ("data", function (data) { if (data) stdout += data }); // 2>&1
child.on ("exit", function (code, signal) {
- var lines = stdout.join ("").replace (/^\s+|\s+$/g, "").split ("\n");
+ var lines = stdout.replace (/^\s+|\s+$/g, "").split ("\n");
if (code === 0) {
hollaback.call (object, { data: { type: lines.splice (1, lines.length - 2).join (" ")
Please sign in to comment.
Something went wrong with that request. Please try again.