gf3 / sandbox

A nifty JavaScript sandbox for Node.js
ISC License
844 stars 123 forks source link

output.console is empty #17

Open speg opened 12 years ago

speg commented 12 years ago
var code = "function add( a, b ){console.log( a );console.log( b );return a + b}add( 20, 22 );";

s.run( code, function( output ) {
  console.log(output.result + "\n" + output.console);
})

Yields:

42
gf3 commented 12 years ago

Ruh roh, I'll have a look into this. Thanks for the report. BTW which version of both Sandbox and Node are you using?

speg commented 12 years ago

Sorry for the delay.

Node: v0.6.15 Sandbox: 0.8.3

TimNZ commented 11 years ago

Bump

Node 0.8.5 Latest sandbox from here

TimNZ commented 11 years ago

I've never submitted a patch but will do it at some point.

In shovel.js, change line 65: console.push.apply(console, JSON.parse(value).slice(1)); to console.push.apply(console, JSON.parse(value));

I can't see how the slice ended up there, or the reason for the convoluted push.apply as I'm a novice JSer.

wupsbr commented 11 years ago

The @TimNZ suggestion worked for me! Thanks!