Skip to content

Inserting CR in addition to LF in util.inspect() is not right on UNIX OSes #8163

Closed
@alanmimms

Description

@alanmimms

Reproduce with this:

console.log('foo');
console.log(require('util').inspect());

Run this with its output redirected to a file then open that file with, e.g., the Emacs editor. Note the first line has only a LF on the end of it as is traditional for thousands of years in Linux/UNIX OSes. Note that lines containing util.inspect() output end in CRLF, which displays in Emacs as an ugly and wrong ^M on the end of that line.

This behavior of mixing the line ending styles on UNIX OSes will cause all sorts of problems with editors, source code management systems, various text processing utilities, etc. It seems clear that util.inspect() should not unilaterally introduce separate line ending semantics from the rest of the system, or ones that are antithetical to the most common OS node.js runs on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions