introduce a reliable timeout

Defaults to 5 seconds.
hook up stderr with a pipe