Couldn't this just subscribe to the `end` event on the child's stdout?