Run code 'with' temporarily modified global state
