We were with the Prophet ﷺ when the sun was eclipsed. He rose and headed to the mosque, dragging his cloak behind him in his haste. The people gathered around him, and he led them in two units of prayer just as they normally prayed. When the eclipse had passed, he addressed us, saying, "The sun and the moon are two signs among the signs of Allah, by which He frightens His servants. They do not eclipse for the death of anyone. So when you see either of them eclipsed, pray and supplicate until what afflicts you is removed."
أخبرنا عمرو بن علي قال حدثنا يزيد وهو ابن زريع قال حدثنا يونس عن الحسن
كنا عند النبي ﷺ فانكسفت الشمس فقام إلى المسجد يجر رداءه من العجلة فقام إليه الناس فصلى ركعتين كما يصلون فلما انجلت خطبنا فقال إن الشمس والقمر آيتان من آيات الله يخوف بهما عباده وإنهما لا ينكسفان لموت أحد فإذا رأيتم كسوف أحدهما فصلوا وادعوا حتى ينكشف ما بكم
Bukhari narrated it in the Book of Eclipse, chapter titled "Prayer during a solar eclipse," h:1040, from the hadith of Yunus bin Ubayd through that same route, and it is also in Kubra, h:1889.