about summary refs log tree commit diff
path: root/src/libstd/sys/windows/stdio.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-295/+0
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-1/+1
2019-11-29Format libstd/sys with rustfmtDavid Tolnay-30/+42
This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd/sys *that are not involved in any currently open PR* to minimize merge conflicts. THe list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in outstanding_files, the relevant commands were: $ find src/libstd/sys -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libstd/sys outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of the files. To confirm no funny business: $ git checkout $THIS_COMMIT^ $ git show --pretty= --name-only $THIS_COMMIT \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ git diff $THIS_COMMIT # there should be no difference
2019-02-28Fix rebase failTaiki Endo-1/+1
2019-02-28libstd => 2018Taiki Endo-8/+8
2019-02-23Remove pub(crate) from stderr_rawPaul Dicker-1/+1
2019-02-20Use standard Read/Write traits in sys::stdioPaul Dicker-36/+45
2019-02-20Address review commentsPaul Dicker-22/+36
2019-02-20Refactor Windows stdio and remove stdin double bufferingPaul Dicker-114/+176
2019-02-20Remove unused Read implementation on sys::Windows::StdinPaul Dicker-9/+0
2019-02-20Remove sys::*::Stderr Write implementationPaul Dicker-14/+1
2019-02-03Improve error message and docs for non-UTF-8 bytes in stdio on WindowsAustin Bonander-1/+3
cc #23344
2019-01-01privacy: Use common `DefId` visiting infra for all privacy visitorsVadim Petrochenkov-5/+0
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-06Refactor stderr_prints_nothing into a more modular functionJethro Beekman-2/+2
2018-12-01remove some uses of try!Mark Mansi-2/+2
2018-04-13std: Minimize size of panicking on wasmAlex Crichton-0/+4
This commit applies a few code size optimizations for the wasm target to the standard library, namely around panics. We notably know that in most configurations it's impossible for us to print anything in wasm32-unknown-unknown so we can skip larger portions of panicking that are otherwise simply informative. This allows us to get quite a nice size reduction. Finally we can also tweak where the allocation happens for the `Box<Any>` that we panic with. By only allocating once unwinding starts we can reduce the size of a panicking wasm module from 44k to 350 bytes.
2017-11-08std: Change how EBADF is handled in `sys`Alex Crichton-1/+4
This commit removes the reexport of `EBADF_ERR` as a constant from libstd's portability facade, instead opting for a platform-specific function that specifically queries an `io::Error`. Not all platforms may have a constant for this, so it makes the intent a little more clear that a code need not be supplied, just an answer to a query.
2017-06-20Add `Read::initializer`.Steven Fackler-5/+0
This is an API that allows types to indicate that they can be passed buffers of uninitialized memory which can improve performance.
2017-03-23std: Don't cache stdio handles on WindowsAlex Crichton-53/+39
This alters the stdio code on Windows to always call `GetStdHandle` whenever the stdio read/write functions are called as this allows us to track changes to the value over time (such as if a process calls `SetStdHandle` while it's running). Closes #40490
2016-12-26Auto merge of #38274 - elahn:windows-readconsole-ctrl-z, r=alexcrichtonbors-2/+22
Ctrl-Z returns from Stdin.read() when reading from the console on Windows Fixes #19914. Fixes read(), read_to_string(), read_to_end(), etc. r? @alexcrichton
2016-12-10Ctrl-Z returns from Stdin.read() when reading from the console onElahn Ientile-2/+22
Windows. Fixes #19914. Fixes read(), read_to_string(), read_to_end(), etc.
2016-11-28Commit to fix make tidyJeremy Soller-1/+1
2016-11-28Move stdout/err flush into sysJeremy Soller-1/+12
2016-11-01std: Move a plattform-specific constant to sys::stdioBrian Anderson-0/+5
2016-10-01std: Move platform specific stdio code into sysBrian Anderson-0/+2
2016-08-24Use `#[prelude_import]` in `libstd`.Jeffrey Seyfried-1/+0
2016-03-22try! -> ?Jorge Aparicio-4/+4
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-12Further simplify Windows stdout/stderrOliver Middleton-13/+8
This makes it output as much valid UTF-8 as it can then return failure.
2016-03-10Simplify Windows stdout/stderrOliver Middleton-4/+2
2016-03-10Fixup stout/stderr on WindowsOliver Middleton-2/+24
WriteConsoleW can fail if called with a large buffer so we need to slice any stdout/stderr output. However the current slicing has a few problems: 1. It slices by byte but still expects valid UTF-8. 2. The slicing happens even when not outputting to a console. 3. panic! output is not sliced. This fixes these issues by moving the slice to right before WriteConsoleW and slicing on a char boundary.
2016-03-09std: Don't spawn threads in `wait_with_output`Alex Crichton-0/+2
Semantically there's actually no reason for us to spawn threads as part of the call to `wait_with_output`, and that's generally an incredibly heavyweight operation for just reading a few bytes (especially when stderr probably rarely has bytes!). An equivalent operation in terms of what's implemented today would be to just drain both pipes of all contents and then call `wait` on the child process itself. On Unix we can implement this through some convenient use of the `select` function, whereas on Windows we can make use of overlapped I/O. Note that on Windows this requires us to use named pipes instead of anonymous pipes, but they're semantically the same under the hood.
2016-03-08std: Funnel read_to_end through to one locationAlex Crichton-0/+17
This pushes the implementation detail of proxying `read_to_end` through to `read_to_end_uninitialized` all the way down to the `FileDesc` and `Handle` implementations on Unix/Windows. This way intermediate layers will also be able to take advantage of this optimized implementation. This commit also adds the optimized implementation for `ChildStdout` and `ChildStderr`.
2016-02-29std: Stabilize APIs for the 1.8 releaseAlex Crichton-1/+1
This commit is the result of the FCPs ending for the 1.8 release cycle for both the libs and the lang suteams. The full list of changes are: Stabilized * `braced_empty_structs` * `augmented_assignments` * `str::encode_utf16` - renamed from `utf16_units` * `str::EncodeUtf16` - renamed from `Utf16Units` * `Ref::map` * `RefMut::map` * `ptr::drop_in_place` * `time::Instant` * `time::SystemTime` * `{Instant,SystemTime}::now` * `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier` * `{Instant,SystemTime}::elapsed` * Various `Add`/`Sub` impls for `Time` and `SystemTime` * `SystemTimeError` * `SystemTimeError::duration` * Various impls for `SystemTimeError` * `UNIX_EPOCH` * `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign` Deprecated * Scoped TLS (the `scoped_thread_local!` macro) * `Ref::filter_map` * `RefMut::filter_map` * `RwLockReadGuard::map` * `RwLockWriteGuard::map` * `Condvar::wait_timeout_with` Closes #27714 Closes #27715 Closes #27746 Closes #27748 Closes #27908 Closes #29866
2015-11-09std: Migrate to the new libcAlex Crichton-6/+5
* Delete `sys::unix::{c, sync}` as these are now all folded into libc itself * Update all references to use `libc` as a result. * Update all references to the new flat namespace. * Moves all windows bindings into sys::c
2015-07-09Use vec![elt; n] where possibleUlrik Sverdrup-2/+1
The common pattern `iter::repeat(elt).take(n).collect::<Vec<_>>()` is exactly equivalent to `vec![elt; n]`, do this replacement in the whole tree. (Actually, vec![] is smart enough to only call clone n - 1 times, while the former solution would call clone n times, and this fact is virtually irrelevant in practice.)
2015-06-14Implement RFC 1014Steven Fackler-9/+11
Closes #25977 The various `stdfoo_raw` methods in std::io now return `io::Result`s, since they may not exist on Windows. They will always return `Ok` on Unix-like platforms. [breaking-change]
2015-05-29std::io: New ErrorKind value InvalidDataMikhail Zabaluev-1/+1
This takes the cases from InvalidInput where a data format error was encountered. This is different from the documented semantics of InvalidInput, which more likely indicate a programming error.
2015-04-29std: Fix inheriting standard handles on windowsAlex Crichton-3/+13
Currently if a standard I/O handle is set to inherited on Windows, no action is taken and the slot in the process information description is set to `INVALID_HANDLE_VALUE`. Due to our passing of `STARTF_USESTDHANDLES`, however, this means that the handle is actually set to nothing and if a child tries to print it will generate an error. This commit fixes this behavior by explicitly creating stdio handles to be placed in these slots by duplicating the current process's I/O handles. This is presumably what previously happened silently by using a file-descriptor-based implementation instead of a `HANDLE`-centric implementation. Along the way this cleans up a lot of code in `Process::spawn` for Windows by ensuring destructors are always run, using more RAII, and limiting the scope of `unsafe` wherever possible.
2015-03-31Test fixes and rebase conflicts, round 3Alex Crichton-3/+2
2015-03-13Fallout of std::old_io deprecationAlex Crichton-0/+10
2015-02-28std: Implement stdio for `std::io`Alex Crichton-0/+155
This is an implementation of RFC 899 and adds stdio functionality to the new `std::io` module. Details of the API can be found on the RFC, but from a high level: * `io::{stdin, stdout, stderr}` constructors are now available. There are also `*_raw` variants for unbuffered and unlocked access. * All handles are globally shared (excluding raw variants). * The stderr handle is no longer buffered. * All handles can be explicitly locked (excluding the raw variants). The `print!` and `println!` machinery has not yet been hooked up to these streams just yet. The `std::fmt::output` module has also not yet been implemented as part of this commit.