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

Confusing values for Process.run input, output and error #3084

Closed
ysbaddaden opened this issue Aug 3, 2016 · 3 comments · Fixed by #4445
Closed

Confusing values for Process.run input, output and error #3084

ysbaddaden opened this issue Aug 3, 2016 · 3 comments · Fixed by #4445

Comments

@ysbaddaden
Copy link
Contributor

In light of #3079 I was reminded that the choices to communicate with a Process are confusing, and impossible to remember without the documentation. While an IO and false are behaving as one can expect (use the IO and close/discard the IO), the nil and true values are weird. For example input: true to create an IO object to allow me to communicate with the child process, but instead the child process will inherit STDIN from the parent! Last but not least, explicitly passing nil means that an IO object will be created... what?!

I'm proposing this breaking change:

  • IO: uses the given IO (no change);
  • true: creates an IO we can read/write to (breaking change);
  • false: closes IO, disabling communication (default, no change);

There is no explicit usage for nil so maybe it could mean "do nothing special", that is "inherit from the current process" (breaking change)?

@asterite
Copy link
Member

asterite commented Aug 3, 2016

Alternatively maybe we can have an enum with more explicit names.

@ysbaddaden
Copy link
Contributor Author

That would be more explicit. How would we call that enum? I can't think of anything...

Values are easier: Inherit, Pipe and Close?

@asterite
Copy link
Member

asterite commented Aug 3, 2016

Right now there's an Stdio alias, but I don't think it's a good name. I don't know what a good name could be, maybe IoOption, and then we could have those names as constants inside Process so you could simply write Process::INHERIT, Process::PIPE, Process::CLOSE.

Eventually we'd like to be able to make symbol literals match enums, so we could pass :inherit, :pipe, etc.

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

Successfully merging a pull request may close this issue.

4 participants