Don't read from stdout in hijack unless attached. Fixes #1503
Merge pull request #1525 from griff/1503-fix

Don't read from stdout when only attached to stdin