Add a snippet of code to manage subprocess with a timeout in an platform independent way