Skip to content

Rollup of 17 pull requests #50807

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

Merged
merged 46 commits into from
May 17, 2018
Merged
Changes from 2 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
1133a14
Implement From for more types on Cow
burtonageo Apr 22, 2018
ea8131d
Add cstring_from_cow_cstr and osstring_from_cow_osstr
burtonageo Apr 27, 2018
d87b039
Add pathbuf_from_cow_path
burtonageo Apr 27, 2018
f3e858a
Update the stable attributes to use the current nightly version number
burtonageo Apr 27, 2018
17e2628
Update features to 1.28.0
burtonageo May 9, 2018
7c0f664
Fix typo
burtonageo May 9, 2018
587566e
Fix `fn main() -> impl Trait` for non-`Termination` trait
leoyvens May 11, 2018
56f505e
read2: Use inner function instead of closure
udoprog May 14, 2018
f73c4a4
env: remove unwrap in examples in favor of try op
udoprog May 14, 2018
6d1da82
Don't unconditionally set CLOEXEC twice on every fd we open on Linux
tbu- May 14, 2018
f46b888
Remove LazyBTreeMap.
nnethercote May 14, 2018
9415adc
deprecate #![doc(no_default_passes, passes, plugins)]
QuietMisdreavus Apr 20, 2018
bb6224b
add ui test for rustdoc's deprecated attributes
QuietMisdreavus Apr 23, 2018
10ac995
drop unnecessary "warning" from warning text
QuietMisdreavus May 14, 2018
30d9502
Add missing error codes in libsyntax-ext asm
GuillaumeGomez May 14, 2018
ba2b4b1
Make mutable_noalias and arg_align_attributes be tracked
nox May 15, 2018
0582d02
Rename ret_ty to declared_ret_ty
leoyvens May 15, 2018
a90a963
Fix run-make wasm tests
ehuss May 15, 2018
a4224eb
Fix an ICE when casting a nonexistent const
varkor May 15, 2018
e8e5eb5
Ensure libraries built in stage0 have unique metadata
cuviper May 16, 2018
7eefe2b
Fix rustdoc panic with `impl Trait` in type parameters
sinkuu May 14, 2018
a2896bf
fix a typo in signed-integer::from_str_radix()
shamiao May 16, 2018
d623f45
Rollup merge of #50638 - tbu-:pr_open_cloexec_once, r=nagisa
kennytm May 16, 2018
5cc6fd3
Rollup merge of #50656 - leodasvacas:fix-impl-trait-in-main-ret, r=ni…
kennytm May 16, 2018
5074a7e
Rollup merge of #50669 - QuietMisdreavus:deprecated-attrs, r=Guillaum…
kennytm May 16, 2018
2d46b90
GitHub: Stop treating Cargo.lock as a generated file.
kennytm May 16, 2018
ee85bfd
Make core::nonzero private
SimonSapin Feb 16, 2018
c536639
Remove unstable deprecated num::NonZeroI* types
SimonSapin Mar 24, 2018
89d9ca9
Stabilize num::NonZeroU*
SimonSapin May 16, 2018
5c10185
tidy: Add a check for empty UI test files
yaahc May 16, 2018
16adb0c
Remove empty files
yaahc May 16, 2018
6ed200a
Remove empty file introduced by rebase
yaahc May 16, 2018
fc6c08e
Rollup merge of #50726 - udoprog:read2-inner-fn, r=alexcrichton
kennytm May 16, 2018
539a376
Rollup merge of #50728 - sinkuu:fix_50702, r=GuillaumeGomez
kennytm May 16, 2018
06e6173
Rollup merge of #50736 - udoprog:env-try-op, r=shepmaster
kennytm May 16, 2018
bb20dc1
Rollup merge of #50740 - nnethercote:rm-LazyBTreeMap, r=cramertj
kennytm May 16, 2018
39129a5
Rollup merge of #50752 - GuillaumeGomez:more-error-code-in-libsyntax-…
kennytm May 16, 2018
380066b
Rollup merge of #50779 - nox:untracked-options, r=rkruppe
kennytm May 16, 2018
9ced69d
Rollup merge of #50787 - ehuss:fix-run-make-wasm, r=alexcrichton
kennytm May 16, 2018
d3bf721
Rollup merge of #50788 - varkor:missing-const-cast, r=cramertj
kennytm May 16, 2018
e4f8132
Rollup merge of #50789 - cuviper:bootstrap-metadata, r=alexcrichton
kennytm May 16, 2018
0306630
Rollup merge of #50797 - shamiao:patch-1, r=kennytm
kennytm May 16, 2018
63ea42f
Rollup merge of #50793 - jrlusby:master, r=petrochenkov
kennytm May 16, 2018
02aedec
Rollup merge of #50808 - SimonSapin:nonzero, r=alexcrichton
kennytm May 16, 2018
8366780
Rollup merge of #50170 - burtonageo:more_cow_from, r=alexcrichton
kennytm May 16, 2018
3c261a4
Rollup merge of #50809 - kennytm:show-cargo-lock-diff, r=alexcrichton
kennytm May 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions src/libstd/sys/unix/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,6 @@ pub fn read2(p1: AnonPipe,
// wait for either pipe to become readable using `poll`
cvt_r(|| unsafe { libc::poll(fds.as_mut_ptr(), 2, -1) })?;

// Read as much as we can from each pipe, ignoring EWOULDBLOCK or
// EAGAIN. If we hit EOF, then this will happen because the underlying
// reader will return Ok(0), in which case we'll see `Ok` ourselves. In
// this case we flip the other fd back into blocking mode and read
// whatever's leftover on that file descriptor.
let read = |fd: &FileDesc, dst: &mut Vec<u8>| {
match fd.read_to_end(dst) {
Ok(_) => Ok(true),
Err(e) => {
if e.raw_os_error() == Some(libc::EWOULDBLOCK) ||
e.raw_os_error() == Some(libc::EAGAIN) {
Ok(false)
} else {
Err(e)
}
}
}
};
if fds[0].revents != 0 && read(&p1, v1)? {
p2.set_nonblocking(false)?;
return p2.read_to_end(v2).map(|_| ());
Expand All @@ -127,4 +109,23 @@ pub fn read2(p1: AnonPipe,
return p1.read_to_end(v1).map(|_| ());
}
}

// Read as much as we can from each pipe, ignoring EWOULDBLOCK or
// EAGAIN. If we hit EOF, then this will happen because the underlying
// reader will return Ok(0), in which case we'll see `Ok` ourselves. In
// this case we flip the other fd back into blocking mode and read
// whatever's leftover on that file descriptor.
fn read(fd: &FileDesc, dst: &mut Vec<u8>) -> Result<bool, io::Error> {
match fd.read_to_end(dst) {
Ok(_) => Ok(true),
Err(e) => {
if e.raw_os_error() == Some(libc::EWOULDBLOCK) ||
e.raw_os_error() == Some(libc::EAGAIN) {
Ok(false)
} else {
Err(e)
}
}
}
}
}