Skip to content
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

Open3 method signatures do not allow the optional env hash as first argument #37

Open
eoinkelly opened this issue Jun 27, 2019 · 0 comments

Comments

@eoinkelly
Copy link

Many methods in the Open3 module allow us to optionally pass a Hash as the first positional argument (the hash is used to set the environment for the spawned process) e.g.

stdin, stdout, stderr, wait_thr = Open3.popen3([env,] cmd... [, opts])

The type signatures for these methods currently forbid this e.g.

module Open3
sig do
params(
cmd: T.any(String, T::Array[String]),
opts: T::Hash[Symbol, T.untyped],
block: T.proc.params(stdin: IO, stdout: IO, stderr: IO, wait_thr: Thread).void
).returns([IO, IO, IO, Thread])
end
def self.popen3(*cmd, **opts, &block); end

I can "fix" this by changing the type of the cmd from T.any(String, T::Array[String]) to cmd: T.any(String, T::Array[String], T::Hash[String, String]) but that seems wrong to me. Is there a better way to express these method signatures?

I'm happy to attempt a PR for this.

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

No branches or pull requests

1 participant