Bhagavad Gita · 5.23
शक्नोतीहैव यः सोढुं प्राक्शरीरविमोक्षणात्।कामक्रोधोद्भवं वेगं स युक्तः स सुखी नरः॥
śhaknotīhaiva yaḥ soḍhuṁ prāk śharīra-vimokṣhaṇāt kāma-krodhodbhavaṁ vegaṁ sa yuktaḥ sa sukhī naraḥ
One who is able to withstand the impulse arising from desire and anger, even before giving up the body — that person is a yogi, that person is truly happy.
— Bhagavad Gita 5.23
Source: Sacred-Texts.com (Sanskrit) + Bhagavad-Gita.io (translations)