HOWTO determine if a command in a pipeline has ended.