Fix issue when attaching stdin alone

Fixes #1004