Skip to content

Commit

Permalink
fix portability of sandbox.run_code() on Node.js 0.1x (#2078)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl committed Jun 9, 2017
1 parent 9186859 commit 4ad7b1d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
14 changes: 14 additions & 0 deletions test/compress/sandbox.js
@@ -0,0 +1,14 @@
console_log: {
input: {
console.log("%% %s");
console.log("%% %s", "%s");
}
expect: {
console.log("%% %s");
console.log("%% %s", "%s");
}
expect_stdout: [
"%% %s",
"% %s",
]
}
5 changes: 4 additions & 1 deletion test/sandbox.js
Expand Up @@ -52,7 +52,10 @@ exports.run_code = function(code) {
"}();",
].join("\n"), {
console: {
log: function() {
log: function(msg) {
if (arguments.length == 1 && typeof msg == "string") {
return console.log("%s", msg);
}
return console.log.apply(console, [].map.call(arguments, function(arg) {
return safe_log(arg, 3);
}));
Expand Down

0 comments on commit 4ad7b1d

Please sign in to comment.