deal with exit in subprocess