Handle error in subprocess