Improve subprocess error handling.