Sitelet https://github.com/rtomayko/posix-spawn/issues/4
Skip to content

Spawn::Child should support encodings properly under 1.9 #4

Description

@rtomayko

Right now we're forcing the encoding of the input string to BINARY and also setting the output streams to BINARY for reads. See:

af16f2a

To be consistent with Ruby's core IO methods we'd need to.

  1. Accept input in any encoding and transcode to Encoding::default_external or a user-specified external encoding when writing to the stdin fd.
  2. Read data off of the stdout/stderr assuming the default Encoding::default_external or user-specified external_encoding and transcode to the Encoding::internal_encoding.
  3. Add support for overriding the default external/internal encodings as options to Child::new.

One weird thing I noticed when working on this previously is that IO#readpartial and IO#write_nonblock seem to ignore the IO object's encoding, unlike the IO#read and IO#write methods. We get BINARY encoded data out no matter what the external/internal encoding is set to. Something to look into when we fix this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions