Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fs: make process.stdout and stderr descend from Writable. #8828

Copy link
Copy link
@mcollina

Description

@mcollina
Issue body actions

process.stdout and process.stderr are not implementing Stream 2 or 3 if they are redirected to a file. They are a SyncWriteStream:

stream = new fs.SyncWriteStream(fd, { autoClose: false });
.
This is were the choice is made.:
case 'FILE':
const fs = require('internal/fs');
stream = new fs.SyncWriteStream(fd, { autoClose: false });
stream._type = 'fs';
break;

I know too little of the stdio sync/async situation to identify what should be preferred change. Ideally process.stdout and process.stderr should come from the streams implementations, but I might be wrong.
What are the implications of doing so? Why is this needed in the first place?
As an example, can we use net.Socket instead

stream = new net.Socket({
fd: fd,
readable: false,
writable: true
});
?

Issues related:
sindresorhus/is-stream#5
pinojs/pino#85
pinojs/pino#86

cc @jasnell @Fishrock123 @jsumners @catdad @sindresorhus @nodejs/streams

sindresorhus and silverwind

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.processIssues and PRs related to the process subsystem.Issues and PRs related to the process subsystem.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.