protoc-gen-grpc-swift: FileHandle for stdin, stdout #1361
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a case where the output response is silently truncated.
Truncation occurs because the
write
syscall is only invoked a singletime, but
write
may return a value indicating a partial write forvarious reasons, even in a blocking call. For example, if stdout is a
nonblocking pipe, output is truncated when the pipe is full.
Instead of rewriting Stdout.write to handle this case, let's migrate to
FileHandle for I/O, available as of Swift 3.2. swift-protobuf has
already migrated to FileHandle, see also
github.com/apple/swift-protobuf/commit/2ccad3484e06d180af3bd7be53c96d41e8f03a62