Skip to content

Exec stdin might lost data if pass in Readable.from(string) #1772

@hax

Description

@hax

const buff = Buffer.alloc(data.length + 1);

Current implementation assume stdin is always a binary stream, but it does not really check the type. So if pass Readable.from(string) as stdin, most time it works, unless the string contains non-ASCII characters, in such case, data is string and data.length is number of UTF16 code units, which will smaller than the number of UTF8 code units or bytes.

I suggest the implementation should either deal with the string case, or just throw type error if not buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions