Log commands (i.e. gcc) and save the enviroment (env variables, current working directory and arguments) to be able to later restart the command