{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/35975","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/35975/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/35975/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/35975/events","html_url":"https://github.com/rust-lang/rust/pull/35975","id":173089319,"number":35975,"title":"Buffer unix and lock windows to prevent message interleaving","user":{"login":"jonathandturner","id":547158,"avatar_url":"https://avatars.githubusercontent.com/u/547158?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathandturner","html_url":"https://github.com/jonathandturner","followers_url":"https://api.github.com/users/jonathandturner/followers","following_url":"https://api.github.com/users/jonathandturner/following{/other_user}","gists_url":"https://api.github.com/users/jonathandturner/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathandturner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathandturner/subscriptions","organizations_url":"https://api.github.com/users/jonathandturner/orgs","repos_url":"https://api.github.com/users/jonathandturner/repos","events_url":"https://api.github.com/users/jonathandturner/events{/privacy}","received_events_url":"https://api.github.com/users/jonathandturner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"assignees":[{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-08-25T00:33:08Z","updated_at":"2016-08-25T00:39:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/35975","html_url":"https://github.com/rust-lang/rust/pull/35975","diff_url":"https://github.com/rust-lang/rust/pull/35975.diff","patch_url":"https://github.com/rust-lang/rust/pull/35975.patch"},"body":"When cargo does a build on multiple processes, multiple crates may error at the same time.  If this happens, currently you'll see interleaving of the error messages, which makes for an unreadable message.\r\n\r\nExample:\r\n\r\n```\r\n# Pastebin KMLAYg9M\r\n    --> --> src/bin/multithread-unix.rs:16:35src/bin/singlethread.rs:16:24\r\n\r\n      ||\r\n\r\n1616  | |     Server::new(&addr).workers(8).    Server::new(&addr).serveserve(|r: Request| {(|r: Request| {\r\n\r\n      | |                                                          ^^^^^^^^^^ expected struct `std::io::Error`, found () expected struct `std::io::Error`, found ()\r\n\r\n      ||\r\n\r\n      = = notenote: expected type `std::io::Error`: expected type `std::io::Error`\r\n\r\n      = = notenote:    found type `()`:    found type `()`\r\n\r\n      = = notenote: required because of the requirements on the impl of `futures_minihttp::Service<futures_minihttp::Request, futures_minihttp::Response>` for `[closure@src/bin/multithread-unix.rs:16:41: 22:6]`: required because of the requirements on the impl of `futures_minihttp::Service<futures_minihttp::Request, futures_minihttp::Response>` for `[closure@src/bin/singlethread.rs:16:30: 22:6]`\r\n\r\n\r\n\r\nerror: aborting due to previous error\r\n\r\nerror: aborting due to previous error\r\n```\r\n\r\nThis patch uses two techniques to prevent this interleaving.  On Unix systems, since they use the text-based ANSI protocol for coloring, we can safely buffer up whole messages before we emit.  This PR does this buffering, and emits the whole message at once.\r\n\r\nOn Windows, term must use the Windows terminal API to color the output.  This disallows us from using the same buffering technique.  Instead, here we grab a Windows mutex (thanks to @alexcrichton for the lock code).  This lock only works in Windows and will hold a mutex for the duration of a message output.\r\n\r\nr? @nikomatsakis "},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/242250362","html_url":"https://github.com/rust-lang/rust/pull/35975#issuecomment-242250362","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/35975","id":242250362,"user":{"login":"jonathandturner","id":547158,"avatar_url":"https://avatars.githubusercontent.com/u/547158?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathandturner","html_url":"https://github.com/jonathandturner","followers_url":"https://api.github.com/users/jonathandturner/followers","following_url":"https://api.github.com/users/jonathandturner/following{/other_user}","gists_url":"https://api.github.com/users/jonathandturner/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathandturner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathandturner/subscriptions","organizations_url":"https://api.github.com/users/jonathandturner/orgs","repos_url":"https://api.github.com/users/jonathandturner/repos","events_url":"https://api.github.com/users/jonathandturner/events{/privacy}","received_events_url":"https://api.github.com/users/jonathandturner/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T00:39:48Z","updated_at":"2016-08-25T00:39:48Z","body":"Also worth a mention that this does allow interleaving of error messages themselves.  For example, this is still valid output:\r\n\r\n```\r\nerror: expected item, found `asfdasdfa23232342`\r\n --> src/lib.rs:8:1\r\n  |\r\n8 | asfdasdfa23232342\r\n  | ^^^^^^^^^^^^^^^^^\r\n\r\nerror: expected item, found `asfdasdfa23232342`\r\n --> src/lib.rs:8:1\r\n  |\r\n8 | asfdasdfa23232342\r\n  | ^^^^^^^^^^^^^^^^^\r\n\r\nerror: aborting due to previous error\r\n\r\nerror: aborting due to previous error\r\n```\r\n\r\n(notice: the multiple \"aborting\" at the end)\r\n\r\nThis is desirable as it ensures we're still probably streaming out errors as they happen rather than buffering multiple messages and emitting them as one group."}}
{"actor":{"display_login":"jonathandturner"}}