Skip to content
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

"error writing buffer" on Windows when piped #8330

Closed
darkf opened this issue Aug 6, 2013 · 1 comment · Fixed by #9901
Closed

"error writing buffer" on Windows when piped #8330

darkf opened this issue Aug 6, 2013 · 1 comment · Fixed by #9901

Comments

@darkf
Copy link
Contributor

darkf commented Aug 6, 2013

On Windows, emitting a lot of text, for example using this program:

    fn main() {
        for _ in range(0, 1000) {
            println("nananananana");
        }
    }

If you pipe it to a program like head, it can (as in, it's seemingly random, probably due to OS buffering, but occurs a lot for small n) fail with "The operation completed successfully.\r\n".

Example:

$ reproduce.exe | head -n 1
nananananana
rust: ~"\"error writing buffer\""
rust: ~"The operation completed successfully.\r\n"
rust: task failed at 'explicit failure', C:\Users\darkf\Desktop\rust\src\libstd\io.rs:1223
rust: domain main @0x923960 root task failed
@alexcrichton
Copy link
Member

This will be fixed by #9901 as we move to libuv instead of our own native implementation of printing.

bors added a commit that referenced this issue Oct 24, 2013
Large topics:

* Implemented `rt::io::net::unix`. We've got an implementation backed by "named pipes" for windows for free from libuv, so I'm not sure if these should be `cfg(unix)` or whether they'd be better placed in `rt::io::pipe` (which is currently kinda useless), or to leave in `unix`. Regardless, we probably shouldn't deny windows of functionality which it certainly has.
* Fully implemented `net::addrinfo`, or at least fully implemented in the sense of making the best attempt to wrap libuv's `getaddrinfo` api
* Moved standard I/O to a libuv TTY instead of just a plain old file descriptor. I found that this interacted better when closing stdin, and it has the added bonus of getting things like terminal dimentions (someone should make a progress bar now!)
* Migrate to `~Trait` instead of a typedef'd object where possible. There are only two more types which are blocked on this, and those are traits which have a method which takes by-value self (there's an open issue on this)
* Drop `rt::io::support::PathLike` in favor of just `ToCStr`. We recently had a lot of Path work done, but it still wasn't getting passed down to libuv (there was an intermediate string conversion), and this allows true paths to work all the way down to libuv (and anything else that can become a C string).
* Removes `extra::fileinput` and `extra::io_util`


Closes #9895 
Closes #9975
Closes #8330
Closes #6850 (ported lots of libraries away from std::io)
cc #4248 (implemented unix/dns)
cc #9128 (made everything truly trait objects)
@bors bors closed this as completed in 3f5b221 Oct 24, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants