Joab and the men of Israel stayed in Edom for six months until they killed all the men of Edom.
The Israelites fought the Midianites as the Lord had commanded. They killed all the Midianite men.
This is how it happened. In the past David fought against Edom. Joab was the commander of David’s army. Joab went to Edom to bury his dead soldiers. While there Joab killed all the Edomite men who were still alive.
At the time Hadad was only a young boy. He and some of his father’s servants ran away to Egypt.