➜ nvm use 12.14.1
➜ node -i
Welcome to Node.js v12.14.1.
Type ".help" for more information.
> JSON.stringify(process.stdout)
Thrown:
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'WriteStream'
| property '_writableState' -> object with constructor 'WritableState'
| property 'afterWriteTickInfo' -> object with constructor 'Object'
--- property 'stream' closes the circle
at JSON.stringify (<anonymous>)
>
➜ nvm use 12.14.0
➜ node -i
Welcome to Node.js v12.14.0.
Type ".help" for more information.
> JSON.stringify(process.stdout)
'{"connecting":false,"_hadError":false,"_parent":null,"_host":null,"_readableState":{"objectMode":false,"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":null,"pipesCount":0,"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"paused":true,"emitClose":false,"autoDestroy":false,"destroyed":false,"defaultEncoding":"utf8","awaitDrain":0,"readingMore":false,"decoder":null,"encoding":null},"readable":false,"_events":{},"_eventsCount":3,"_writableState":{"objectMode":false,"highWaterMark":16384,"finalCalled":false,"needDrain":false,"ending":false,"ended":false,"finished":false,"destroyed":false,"decodeStrings":false,"defaultEncoding":"utf8","length":0,"writing":false,"corked":0,"sync":false,"bufferProcessing":false,"writecb":null,"writelen":0,"bufferedRequest":null,"lastBufferedRequest":null,"pendingcb":1,"prefinished":false,"errorEmitted":false,"emitClose":false,"autoDestroy":false,"bufferedRequestCount":0,"corkedRequestsFree":{"next":null,"entry":null}},"writable":true,"allowHalfOpen":false,"_sockname":null,"_pendingData":null,"_pendingEncoding":"","server":null,"_server":null,"columns":210,"rows":80,"_type":"tty","fd":1,"_isStdio":true}'
>
I don't know if it's a bug or an explicit change made in interface. If its known change, then must be reported to the change log.
There are some change introduced in
12.14.1inprocess.stdoutwhich created a circular dependency. This behaviour is not detected in12.14.0, and can't find any reference for changesin published change log.
Here is the simple code to reproduce the issue in
12.14.1It works well with
12.14.0I don't know if it's a bug or an explicit change made in interface. If its known change, then must be reported to the change log.