(instance, streamSymbol)
| 381 | |
| 382 | // Make a function that can serve as the callback passed to `stream.write()`. |
| 383 | function createWriteErrorHandler(instance, streamSymbol) { |
| 384 | return (err) => { |
| 385 | // This conditional evaluates to true if and only if there was an error |
| 386 | // that was not already emitted (which happens when the _write callback |
| 387 | // is invoked asynchronously). |
| 388 | const stream = streamSymbol === kUseStdout ? |
| 389 | instance._stdout : instance._stderr; |
| 390 | if (err !== null && !stream._writableState.errorEmitted) { |
| 391 | // If there was an error, it will be emitted on `stream` as |
| 392 | // an `error` event. Adding a `once` listener will keep that error |
| 393 | // from becoming an uncaught exception, but since the handler is |
| 394 | // removed after the event, non-console.* writes won't be affected. |
| 395 | // we are only adding noop if there is no one else listening for 'error' |
| 396 | if (stream.listenerCount('error') === 0) { |
| 397 | stream.once('error', noop); |
| 398 | } |
| 399 | } |
| 400 | }; |
| 401 | } |
| 402 | |
| 403 | function timeLogImpl(consoleRef, label, formatted, args) { |
| 404 | if (args === undefined) { |
no test coverage detected
searching dependent graphs…