{"action":"created","issue":{"url":"https://api.github.com/repos/book/System-Command/issues/20","labels_url":"https://api.github.com/repos/book/System-Command/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/book/System-Command/issues/20/comments","events_url":"https://api.github.com/repos/book/System-Command/issues/20/events","html_url":"https://github.com/book/System-Command/pull/20","id":124615564,"number":20,"title":"Add success/failure methods to make the UI better","user":{"login":"robkinyon","id":37937,"avatar_url":"https://avatars.githubusercontent.com/u/37937?v=3","gravatar_id":"","url":"https://api.github.com/users/robkinyon","html_url":"https://github.com/robkinyon","followers_url":"https://api.github.com/users/robkinyon/followers","following_url":"https://api.github.com/users/robkinyon/following{/other_user}","gists_url":"https://api.github.com/users/robkinyon/gists{/gist_id}","starred_url":"https://api.github.com/users/robkinyon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robkinyon/subscriptions","organizations_url":"https://api.github.com/users/robkinyon/orgs","repos_url":"https://api.github.com/users/robkinyon/repos","events_url":"https://api.github.com/users/robkinyon/events{/privacy}","received_events_url":"https://api.github.com/users/robkinyon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-01-02T22:47:04Z","updated_at":"2016-01-12T15:56:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/book/System-Command/pulls/20","html_url":"https://github.com/book/System-Command/pull/20","diff_url":"https://github.com/book/System-Command/pull/20.diff","patch_url":"https://github.com/book/System-Command/pull/20.patch"},"body":"These make it nicer to work with the command object."},"comment":{"url":"https://api.github.com/repos/book/System-Command/issues/comments/170955747","html_url":"https://github.com/book/System-Command/pull/20#issuecomment-170955747","issue_url":"https://api.github.com/repos/book/System-Command/issues/20","id":170955747,"user":{"login":"book","id":44421,"avatar_url":"https://avatars.githubusercontent.com/u/44421?v=3","gravatar_id":"","url":"https://api.github.com/users/book","html_url":"https://github.com/book","followers_url":"https://api.github.com/users/book/followers","following_url":"https://api.github.com/users/book/following{/other_user}","gists_url":"https://api.github.com/users/book/gists{/gist_id}","starred_url":"https://api.github.com/users/book/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/book/subscriptions","organizations_url":"https://api.github.com/users/book/orgs","repos_url":"https://api.github.com/users/book/repos","events_url":"https://api.github.com/users/book/events{/privacy}","received_events_url":"https://api.github.com/users/book/received_events","type":"User","site_admin":false},"created_at":"2016-01-12T15:56:01Z","updated_at":"2016-01-12T15:56:01Z","body":"> The buffering you're speaking of is a standard problem when dealing with STDOUT and STDERR. I'm curious why it printed 1 to bother STDOUT and STDERR - that shouldn't have happened.\r\n\r\nThis is an excellent remark. Running the one-liner on the command-line shows the `1`, `11`, `21` lines only once. And piping either standard output or standard error to `/dev/null` shows the expected result.\r\n\r\nI fact, it seems I did something wrong when copy/pasting, because running the following again show the expected output:\r\n\r\n    perl -Ilib -MSystem::Command -MTerm::ANSIColor -e '\r\n        System::Command->loop_on(\r\n            command => [\r\n                qw( perl -le ), q{ print { $i++ % 10 ? STDOUT : STDERR } $i for 1..30 }\r\n            ],\r\n            stdout => sub { print shift },\r\n            stderr => sub { print \"* \", shift },\r\n        );\r\n    ' | head\r\n    2\r\n    * 1\r\n    3\r\n    * 11\r\n    4\r\n    * 21\r\n    5\r\n    6\r\n    7\r\n    8\r\n\r\nThis time I've put the `*` at the beginning of the line, because the line contains an embedded newline."}}