Skip to content

Commit

Permalink
Simplify Windows stdout/stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
ollie27 committed Mar 10, 2016
1 parent 8427efa commit 6993939
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/libstd/sys/windows/stdio.rs
Expand Up @@ -69,8 +69,7 @@ fn write(out: &Output, data: &[u8]) -> io::Result<usize> {
// [1]: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1232
// [2]: http://www.mail-archive.com/log4net-dev@logging.apache.org/msg00661.html
const OUT_MAX: usize = 8192;
let data_len;
let utf16 = match str::from_utf8(data).ok() {
let (utf16, data_len) = match str::from_utf8(data).ok() {
Some(mut utf8) => {
if utf8.len() > OUT_MAX {
let mut new_len = OUT_MAX;
Expand All @@ -79,8 +78,7 @@ fn write(out: &Output, data: &[u8]) -> io::Result<usize> {
}
utf8 = &utf8[..new_len];
}
data_len = utf8.len();
utf8.encode_utf16().collect::<Vec<u16>>()
(utf8.encode_utf16().collect::<Vec<u16>>(), utf8.len())
}
None => return Err(invalid_encoding()),
};
Expand Down

0 comments on commit 6993939

Please sign in to comment.