only pass stdin to hijack when needed

Fixes #2398