Created originally on Bitbucket by bdkearns (Brian Kearns)
Was already merged in Bitbucket before import, marked as merged by the import user
Source changeset not longer availableat the time of import. Commit listwill look empty
previous fix just resulted in skips for automated builds (they don't have controlling ttys), so switch back to pty method and fix test for this method (TIOCGPGRP only seems to work when the child is alive, so add a sleep)