Skip to content

Commit

Permalink
spawn/IO: supercharge the API (#30278)
Browse files Browse the repository at this point in the history
- 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).
  • Loading branch information
vtjnash authored Dec 7, 2018
1 parent 6e8f1b8 commit b55b85c
Show file tree
Hide file tree
Showing 8 changed files with 372 additions and 230 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ Standard library changes
* `current_project()` now searches the parent directories of a Git repository for a `Project.toml` file.
This also affects the behavior of the `--project` command line option when using the default
`--project=@.` ([#29108]).
* The `spawn` API is now more flexible and supports taking IOBuffer directly as a I/O stream,
converting to a system pipe as needed ([#30278]).

#### Dates
* New `DateTime(::Date, ::Time)` constructor ([#29754]).
Expand Down
Loading

0 comments on commit b55b85c

Please sign in to comment.