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

spawn/IO: supercharge the API #30278

Merged
merged 3 commits into from
Dec 7, 2018
Merged

spawn/IO: supercharge the API #30278

merged 3 commits into from
Dec 7, 2018

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Dec 5, 2018

It's been long requested that we allow passing an IOBuffer to spawn and make it "just work". And there were just a number of other cleanup tasks to execute to improve the internal API.

@vtjnash vtjnash added io Involving the I/O subsystem: libuv, read, write, etc. needs tests Unit tests are required for this change labels Dec 5, 2018
@JeffBezanson JeffBezanson added the needs news A NEWS entry is required for this change label Dec 5, 2018
@vtjnash vtjnash force-pushed the jn/spawn-any-stdio branch from 58c02e2 to c30f968 Compare December 6, 2018 19:59
@vtjnash vtjnash removed needs news A NEWS entry is required for this change needs tests Unit tests are required for this change labels Dec 6, 2018
@JeffBezanson JeffBezanson added this to the 1.1 milestone Dec 6, 2018
- Permit IOBuffer as an input/output, and automatically create a Pipe to
feed to/from it.

- Improved handling for using CmdRedirect on fd >= 3

- Allow any number of stdio handles to be passed to the child
(including zero), not just precisely 0-2

- Clearer ownership expectations (less code duplication) in `_spawn`
calls, ensuring we always call `setup_stdio` early and exactly once

- Stop capturing all IO handles in Process.in/.out/.err
Since usually we only have the child side of the handle at the point
we were trying to set this, while we want this to be the parent handle.
Instead, we now handle this at the caller level in the `open` method,
which has better information and intent given for this.
(To preserve the old behavior, we also include the old heuristic
in `run` for setting these handles.)

- Ensure that most of the code won't need to be specialized on every
(stdin, stdout, stderr) tuple combination that gets used

- Implement `open(::OS_HANDLE)` for taking ownership of a raw `fd` handle,
and the corresponding constructors `PipeEndpoint(::OS_HANDLE)` and
`TCP(::OS_HANDLE)` (such as may now be passed via CmdRedirect).
@vtjnash vtjnash force-pushed the jn/spawn-any-stdio branch from c30f968 to 4cc3e62 Compare December 6, 2018 21:42
base/stream.jl Outdated Show resolved Hide resolved
Co-Authored-By: vtjnash <vtjnash@gmail.com>
base/stream.jl Outdated Show resolved Hide resolved
@vtjnash vtjnash merged commit b55b85c into master Dec 7, 2018
@vtjnash vtjnash deleted the jn/spawn-any-stdio branch December 7, 2018 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
io Involving the I/O subsystem: libuv, read, write, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants