Be more intelligent about reading from pipes

Add a new function called read_from() that wraps pselect and puts the result
into a set of std::strings. This helps avoid blocking on an unclosed pipe even
if the test spawns subprocesses that don't terminate. (We also try to kill the
subprocesses by killing the test's process group.)