More accurate termination check for process.exec()