-
Notifications
You must be signed in to change notification settings - Fork 221
Fix IO#reopen, add open3 missing sigs #2359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
like in initialize, it can also receive an integer as mode; also, the same accepted kwargs from initialize are also accepted here
There was a problem hiding this 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] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for IO#popen
@ksss I'll write the tests once we address the broken behaviour for this type of signature 👍 |
@@ -143,5 +240,827 @@ module Open3 | |||
# Open3.capture2e('echo', 'hello', 'world') | |||
# # => ["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] |
There was a problem hiding this comment.
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
IO#reopen
should be able to receive the same kwargs thatIO#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: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.