File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
+ function js_console_log ( ) {
3
+ console . error ( "[log] " + util . format . apply ( this , arguments ) . split ( "\n" ) . join ( "\n[log] " ) ) ;
4
+ }
5
+ function js_console_err ( ) {
6
+ console . error ( "[err] " + util . format . apply ( this , arguments ) . split ( "\n" ) . join ( "\n[err] " ) ) ;
7
+ }
2
8
process . stdin . setEncoding ( "utf8" ) ;
3
9
var incoming = "" ;
4
10
process . stdin . on ( "data" , function ( chunk ) {
@@ -8,14 +14,9 @@ process.stdin.on("data", function(chunk) {
8
14
var fn = JSON . parse ( incoming . substr ( 0 , i ) ) ;
9
15
incoming = incoming . substr ( i + 1 ) ;
10
16
process . stdout . write ( JSON . stringify ( require ( "vm" ) . runInNewContext ( fn , {
11
- util : { format : util . format } ,
12
17
console : {
13
- log : function ( ) {
14
- console . error ( "[log] " + util . format . apply ( this , arguments ) . split ( "\n" ) . join ( "\n[log] " ) ) ;
15
- } ,
16
- error : function ( ) {
17
- console . error ( "[err] " + util . format . apply ( this , arguments ) . split ( "\n" ) . join ( "\n[err] " ) ) ;
18
- }
18
+ log : js_console_log ,
19
+ error : js_console_err
19
20
}
20
21
} ) ) + "\n" ) ;
21
22
}
You can’t perform that action at this time.
0 commit comments