{"action":"opened","issue":{"url":"https://api.github.com/repos/mattbrictson/airbrussh/issues/31","labels_url":"https://api.github.com/repos/mattbrictson/airbrussh/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/mattbrictson/airbrussh/issues/31/comments","events_url":"https://api.github.com/repos/mattbrictson/airbrussh/issues/31/events","html_url":"https://github.com/mattbrictson/airbrussh/issues/31","id":92906493,"number":31,"title":"Replace `tail -n 20` with pure Ruby","user":{"login":"mattbrictson","id":189693,"avatar_url":"https://avatars.githubusercontent.com/u/189693?v=3","gravatar_id":"","url":"https://api.github.com/users/mattbrictson","html_url":"https://github.com/mattbrictson","followers_url":"https://api.github.com/users/mattbrictson/followers","following_url":"https://api.github.com/users/mattbrictson/following{/other_user}","gists_url":"https://api.github.com/users/mattbrictson/gists{/gist_id}","starred_url":"https://api.github.com/users/mattbrictson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattbrictson/subscriptions","organizations_url":"https://api.github.com/users/mattbrictson/orgs","repos_url":"https://api.github.com/users/mattbrictson/repos","events_url":"https://api.github.com/users/mattbrictson/events{/privacy}","received_events_url":"https://api.github.com/users/mattbrictson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mattbrictson/airbrussh/labels/new%20feature","name":"new feature","color":"009800"},{"url":"https://api.github.com/repos/mattbrictson/airbrussh/labels/you%20can%20help!","name":"you can help!","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-03T16:35:23Z","updated_at":"2015-07-03T16:35:23Z","closed_at":null,"body":"Via https://github.com/mattbrictson/airbrussh/issues/24#issuecomment-118317525\r\n\r\n> we should replace the use of tail -n 20 with pure ruby, but would need to do something efficient to handle large files. I'm surprised we haven't seen error reports for this for people using windows.\r\n\r\nThis is referring to `Airbrussh::Formatter#on_deploy_failure`:\r\nhttps://github.com/mattbrictson/airbrussh/blob/2abcc1b034843f3c8fa50ec6e129d6ee628c2698/lib/airbrussh/formatter.rb#L111\r\n\r\n```ruby\r\ndef on_deploy_failure\r\n  return if @log_file.nil?\r\n  err = Airbrussh::Console.new($stderr)\r\n  err.print_line\r\n  err.print_line(red(\"** DEPLOY FAILED\"))\r\n  err.print_line(yellow(\"** Refer to #{@log_file} for details. \"\\\r\n                        \"Here are the last 20 lines:\"))\r\n  err.print_line\r\n  system(\"tail -n 20 #{@log_file.shellescape} 1>&2\")\r\nend\r\n```"}}