dblock/heroku-commander — pull request #4 by macreery (2013-04-02 20:02:41+00:00)
Title: Infinite loop on `heroku logs --tail` retry

If a `heroku logs --tail` invocation succeeds (or exits with `Errno::EIO` or `IOError` instead of `PTY::ChildExited` on the second retry, we end up in an infinite loop, as demonstrated in the following logs from one of our apps:

```
21:04:05 Restarting heroku logs -p run.8151 --tail --app gravity-production, 1 retry left.
21:04:05 Running: heroku logs -p run.8151 --tail --app gravity-production
22:04:12 Started: 20226
22:04:12 Waiting: 20226
22:04:12 Running: heroku logs -p run.8151 --tail --app gravity-production
22:04:18 Started: 20253
22:04:18 Waiting: 20253
22:04:18 Restarting heroku logs -p run.8151 --tail --app gravity-production, -1 retries left.
22:04:18 Running: heroku logs -p run.8151 --tail --app gravity-production
23:04:24 Started: 20264
23:04:25 Waiting: 20264
23:04:25 Restarting heroku logs -p run.8151 --tail --app gravity-production, -2 retries left.
23:04:25 Running: heroku logs -p run.8151 --tail --app gravity-production
00:04:31 Started: 20300
00:04:31 Waiting: 20300
```

I'm happy to write a spec for this, but could use a recommendation on the best way to stub the causing behavior inside `Heroku::Executor`.