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

Conversation

HoneyryderChuck
Copy link
Contributor

IO#reopen should be able to receive the same kwargs that IO#open receives; also, the mode can be an integer too.

Have a separate commit adding missing sigs for open3. @soutaro this is currently a WIP, as the sigs can't be expressed fully in RBS:

  • most functions accept an optional options hash at the end, despite commands (string) already supporting optional (string) args as well. it's like a second set of optional args, and this can't be expressed in RBS.
  • some functions (i.e. pipeline_w return an array where the first element is stdin/stdout (IO) and the rest is one or more wait threads. "variable size" tuples can't be expressed in RBS yet as well.

like in initialize, it can also receive an integer as mode; also, the same accepted kwargs from initialize are also accepted here
Copy link
Collaborator

@ksss ksss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better with test code.

# Open3.capture2('echo', 'hello', 'world')
# # => ["hello world\n", #<Process::Status: pid 2326299 exit 0>]
#
def self.capture2: (?Hash[String, String] env, *String cmds, ?Hash[untyped, untyped] options) -> [IO, Process::Status]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a syntax error.
It seems to me that it would be better expressed in overload.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, hence why I opened this PR in a broken state. I believe that this is a valid and common signature across the stdlib (i.e. options hash optionally at the end) that RBS should be able to acknowledge. I don't think that overload would express it better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for IO#popen

@HoneyryderChuck
Copy link
Contributor Author

@ksss I'll write the tests once we address the broken behaviour for this type of signature 👍

# # => ["hello world\n", #<Process::Status: pid 2371894 exit 0>]
#
def self.capture2e: (*String, ?stdin_data: String, ?binmode: boolish) -> [String, Process::Status]
def self.capture2e: (?Hash[String, String] env, *String cmds, ?Hash[untyped, untyped] options) -> [IO, Process::Status]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The capture* methods return strings, not streams

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

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