Catch stderr before 'exit' signal