File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,9 +76,9 @@ if (!!process.send && process.env.PIPE_LOGGING === 'true') {
7676 res = JSON . stringify ( argsArray , function ( key , value ) {
7777
7878 // Objects get special treatment to prevent circles
79- if ( value && Object . prototype . toString . call ( value ) === '[object Object]' ) {
79+ if ( isObject ( value ) || Array . isArray ( value ) ) {
8080 if ( seen . indexOf ( value ) !== - 1 ) {
81- return Object . create ( null ) ; // prevent circular references!
81+ return '[Circular]' ;
8282 }
8383
8484 seen . push ( value ) ;
@@ -105,6 +105,14 @@ if (!!process.send && process.env.PIPE_LOGGING === 'true') {
105105 }
106106 }
107107
108+ function isObject ( obj ) {
109+ return typeof obj === 'object'
110+ && obj !== null
111+ && ! Array . isArray ( obj )
112+ && ! ( obj instanceof RegExp )
113+ && ! ( obj instanceof Date ) ;
114+ }
115+
108116 // Pass console logging to the outside so that we have it in the main side if told so
109117 if ( process . env . VERBOSE_LOGGING === 'true' ) {
110118 console . log = function ( ) { safeSend ( { type : '__$console' , severity : 'log' , arguments : safeToArray ( arguments ) } ) ; } ;
You can’t perform that action at this time.
0 commit comments