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

Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err #55754

Merged
merged 1 commit into from Nov 14, 2018

Conversation

Projects
None yet
8 participants
@spastorino
Member

spastorino commented Nov 7, 2018

@nikomatsakis

This comment has been minimized.

Contributor

nikomatsakis commented Nov 7, 2018

I don't know this part of the code well, but makes sense to me --

r? @alexcrichton for reassignment

@alexcrichton

This comment has been minimized.

Member

alexcrichton commented Nov 7, 2018

@bors: r+

@bors

This comment has been minimized.

Contributor

bors commented Nov 7, 2018

📌 Commit 683106b has been approved by alexcrichton

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 7, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:01155b76:start=1541601430146560918,finish=1541601483991947598,duration=53845386680
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:52:58] .................................................................................................... 100/4997
[00:53:01] .................................................................................................... 200/4997
[00:53:04] ........................................................................ii...................ii..... 300/4997
[00:53:07] ...........................................................................................iii...... 400/4997
[00:53:10] ..iiiiiiii.iii...........................iii...........................................i...........i 500/4997
[00:53:17] .................................................................................................... 700/4997
[00:53:23] .....................................................................i...........i.................. 800/4997
[00:53:26] ........................................................................................iiiii....... 900/4997
[00:53:30] ...........ii.iiii.................................................................................. 1000/4997
---
[00:54:05] .................................................................................................... 2200/4997
[00:54:09] .................................................................................................... 2300/4997
[00:54:13] .................................................................................................... 2400/4997
[00:54:17] .................................................................................................... 2500/4997
[00:54:20] ..............................................................................iiiiiiiii............. 2600/4997
[00:54:27] .............................ii..................................................................... 2800/4997
[00:54:30] .................................................................................................... 2900/4997
[00:54:34] .................................................................................................... 3000/4997
[00:54:37] ........................i........................................................................... 3100/4997
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:08:36] 
[01:08:36] running 115 tests
[01:08:39] i..ii...iii..iii.....i...i.........i..iii...........i.....i.....ii...i..i.ii...............i..ii..ii 100/115
[01:08:39] .i....iiii.....
[01:08:39] 
[01:08:39]  finished in 3.453
[01:08:39] travis_fold:end:test_codegen

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:08:53] 
[01:08:53] running 118 tests
[01:09:16] .iiiii...i.....i..i...i..i.i..i.i..i.....i..i....i..........iiii.........i.i....i...i.......ii.i.i.i 100/118
[01:09:20] ......iii.i.....ii
[01:09:20] 
[01:09:20]  finished in 26.528
[01:09:20] travis_fold:end:test_debuginfo

---
[01:30:13] .................................................................................................... 400/988
[01:30:20] ......................i..i.....................................iiii........ii....................... 500/988
[01:30:27] .................................................................................................... 600/988
[01:30:34] .................................................................................................... 700/988
[01:30:43] ...........iiii.............................................F..........F............................ 800/988
[01:31:01] ....................................iiii................................................
[01:31:01] failures:
[01:31:01] 
[01:31:01] ---- process.rs - process::Command::output (line 765) stdout ----
[01:31:01] ---- process.rs - process::Command::output (line 765) stdout ----
[01:31:01] error[E0599]: no method named `write` found for type `std::io::Stdout` in the current scope
[01:31:01]    |
[01:31:01]    |
[01:31:01] 12 | io::stdout().write(&output.stdout);
[01:31:01]    |
[01:31:01]    = help: items from traits can only be used if the trait is in scope
[01:31:01] help: the following trait is implemented but not in scope, perhaps add a `use` for it:
[01:31:01]    |
[01:31:01]    |
[01:31:01] 3  | use std::io::Write;
[01:31:01]    |
[01:31:01] 
[01:31:01] error[E0599]: no method named `write` found for type `std::io::Stderr` in the current scope
[01:31:01]    |
[01:31:01]    |
[01:31:01] 13 | io::stderr().write(&output.stderr);
[01:31:01]    |
[01:31:01]    = help: items from traits can only be used if the trait is in scope
[01:31:01] help: the following trait is implemented but not in scope, perhaps add a `use` for it:
[01:31:01]    |
[01:31:01]    |
[01:31:01] 3  | use std::io::Write;
[01:31:01]    |
[01:31:01] 
[01:31:01] thread 'process.rs - process::Command::output (line 765)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13
[01:31:01] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:31:01] 
[01:31:01] ---- process.rs - process::Stdio::inherit (line 953) stdout ----
[01:31:01] error[E0599]: no method named `write` found for type `std::io::Stdout` in the cu

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:28309c58
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:0033793a:start=1541606957609038434,finish=1541606957613290651,duration=4252217
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:03946401
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@alexcrichton

This comment has been minimized.

Member

alexcrichton commented Nov 7, 2018

@bors: r-

@spastorino spastorino force-pushed the spastorino:fix-process-output-docs branch from 683106b to e55e5c7 Nov 7, 2018

@spastorino

This comment has been minimized.

Member

spastorino commented Nov 7, 2018

@alexcrichton doh, force pushed with the thing fixed

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 8, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:276a7b2c:start=1541629775562320355,finish=1541629838554504581,duration=62992184226
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:52:56] .................................................................................................... 100/4999
[00:52:59] .................................................................................................... 200/4999
[00:53:02] ........................................................................ii...................ii..... 300/4999
[00:53:04] ...........................................................................................iii...... 400/4999
[00:53:07] ..iiiiiiii.iii...........................iii...........................................i...........i 500/4999
[00:53:15] .................................................................................................... 700/4999
[00:53:21] .....................................................................i...........i.................. 800/4999
[00:53:24] ........................................................................................iiiii....... 900/4999
[00:53:27] ...........ii.iiii.................................................................................. 1000/4999
---
[00:54:03] .................................................................................................... 2200/4999
[00:54:08] .................................................................................................... 2300/4999
[00:54:12] .................................................................................................... 2400/4999
[00:54:15] .................................................................................................... 2500/4999
[00:54:19] ...................................................................iiiiiiiii........................ 2600/4999
[00:54:26] ...............................ii................................................................... 2800/4999
[00:54:29] .................................................................................................... 2900/4999
[00:54:33] .................................................................................................... 3000/4999
[00:54:35] ..........................i......................................................................... 3100/4999
---
travis_time:start:test_codegen
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:08:49] 
[01:08:49] running 115 tests
[01:08:52] i..ii...iii..iii.....i...i.........i..iii...........i.....i.....ii...i..i.ii..............i...ii..ii 100/115
[01:08:52] .i....iiii.....
[01:08:52] 
[01:08:52]  finished in 3.535
[01:08:52] travis_fold:end:test_codegen

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:09:07] 
[01:09:07] running 118 tests
[01:09:30] .iiiii...i.....i..i...i..i.i..i.i..i.....i..i....i..........iiii.........i.i....i...i.......ii.i.i.i 100/118
[01:09:33] ......iii.i.....ii
[01:09:33] 
[01:09:33]  finished in 26.701
[01:09:33] travis_fold:end:test_debuginfo

---
[01:30:56] .................................................................................................... 400/988
[01:31:05] ......................i..i.....................................iiii........ii....................... 500/988
[01:31:12] .................................................................................................... 600/988
[01:31:20] .................................................................................................... 700/988
[01:31:30] ...........iiii.............................................F..........F............................ 800/988

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Show resolved Hide resolved src/libstd/process.rs Outdated

@spastorino spastorino force-pushed the spastorino:fix-process-output-docs branch from e55e5c7 to 3b3b60c Nov 10, 2018

@alexcrichton

This comment has been minimized.

Member

alexcrichton commented Nov 12, 2018

@bors: r+

@bors

This comment has been minimized.

Contributor

bors commented Nov 12, 2018

📌 Commit 3b3b60c has been approved by alexcrichton

@pietroalbini

This comment has been minimized.

Member

pietroalbini commented Nov 12, 2018

@bors rollup

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Nov 12, 2018

Rollup merge of rust-lang#55754 - spastorino:fix-process-output-docs,…
… r=alexcrichton

Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err

r? @nikomatsakis

kennytm added a commit to kennytm/rust that referenced this pull request Nov 13, 2018

Rollup merge of rust-lang#55754 - spastorino:fix-process-output-docs,…
… r=alexcrichton

Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err

r? @nikomatsakis

kennytm added a commit to kennytm/rust that referenced this pull request Nov 13, 2018

Rollup merge of rust-lang#55754 - spastorino:fix-process-output-docs,…
… r=alexcrichton

Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err

r? @nikomatsakis

bors added a commit that referenced this pull request Nov 13, 2018

Auto merge of #55912 - kennytm:rollup, r=kennytm
Rollup of 21 pull requests

Successful merges:

 - #55589 (Add `VariantIdx` type and use instead of `usize`)
 - #55672 (miri: accept extern types in structs if they are the only field)
 - #55711 (Format BtreeMap::range_mut example)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55793 (Fixes #55775 -- fixed regression in Command::exec's handling of PATH.)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)

bors added a commit that referenced this pull request Nov 13, 2018

Auto merge of #55912 - kennytm:rollup, r=kennytm
Rollup of 21 pull requests

Successful merges:

 - #55136 (Remove short doc where it starts with a codeblock)
 - #55672 (miri: accept extern types in structs if they are the only field)
 - #55711 (Format BtreeMap::range_mut example)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55793 (Fixes #55775 -- fixed regression in Command::exec's handling of PATH.)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)

kennytm added a commit to kennytm/rust that referenced this pull request Nov 13, 2018

Rollup merge of rust-lang#55754 - spastorino:fix-process-output-docs,…
… r=alexcrichton

Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err

r? @nikomatsakis

bors added a commit that referenced this pull request Nov 13, 2018

Auto merge of #55912 - kennytm:rollup, r=kennytm
Rollup of 20 pull requests

Successful merges:

 - #55136 (Remove short doc where it starts with a codeblock)
 - #55711 (Format BtreeMap::range_mut example)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)

bors added a commit that referenced this pull request Nov 13, 2018

Auto merge of #55912 - kennytm:rollup, r=kennytm
Rollup of 20 pull requests

Successful merges:

 - #55136 (Remove short doc where it starts with a codeblock)
 - #55711 (Format BtreeMap::range_mut example)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)

bors added a commit that referenced this pull request Nov 13, 2018

Auto merge of #55912 - kennytm:rollup, r=kennytm
Rollup of 20 pull requests

Successful merges:

 - #55136 (Remove short doc where it starts with a codeblock)
 - #55711 (Format BtreeMap::range_mut example)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)

@bors bors merged commit 3b3b60c into rust-lang:master Nov 14, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
///
/// let output = Command::new("rev")
/// .stdin(Stdio::inherit())
/// .stdout(Stdio::piped())
/// .output()
/// .expect("Failed to execute command");
///
/// println!("You piped in the reverse of: {}", String::from_utf8_lossy(&output.stdout));

This comment has been minimized.

@tamird

tamird Nov 21, 2018

Contributor

This seems wrong, doesn't it? This was previously an atomic write, and now is not?

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