Skip to content

mruby-io doesn't work in process started as Windows service #5114

Description

@kou

#4968 added file descriptor check in IO#initialize.
It raises an exception at IO.open(0, "r") https://github.com/mruby/mruby/blob/master/mrbgems/mruby-io/mrblib/io.rb#L363 when a process is started as Windows service. Because a process started as Windows service doesn't have a valid standard input. fstat(0, buf) returns non-zero.

Here are solutions I think:

  1. Don't check file descriptor for 0, 1 and 2.
  2. Open an internal pipe for 0, 1 and 2 when they are invalid.

Which solution do you like?

I think that 1. is enough.

FYI: CRuby uses 2.: fill_standard_fds() https://github.com/ruby/ruby/blob/master/ruby.c#L2556-L2584

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions