Implement post-exec function