Assume.... killing is unavoidable. How is Buddhism handle in this case ? This is question is meant for normal lay Buddhist and not monk.
Buddhist texts don't instruct to kill or offer any way to kill properly, you are out of your mind.
That being said, if you are going to do it, then do it knowing it is wrong action and don't fool yourself.
If you are inclined to do it then also be honest about what this tells about you as a "Buddhist". Things like you are probably not very much restrained by conscientiousness, not seeing much danger in transgressions, lacking urgency, mindfulness of death not well established, cruelty, greed and general lack of development of the spiritual faculties like faith & judgement.
You should also reflect on this action before, during and after doing it. It is very blameworthy and you should have a lot to think about.
Perhaps after due reflection your mind will be inclined to abstain from killing. Perhaps the reason that you are in this situation where nature took over your house is because you keep doing bad actions.
Anyway if you practice Buddhism correctly you will get great fruition. If you don't you will have a bad destination.
I won't tell you to do it and not worry about it. The only way one gets to do it and not worry about it too much, is if you then stop completely like Angulimalla and even he suffered rather excessively for his killings.
Hell or animal womb is still an option for many people... Death is soon, we shouldn't be packing our bags with dead ants.
You might die before you kill these ants and just because one is thinking about these things one will have a bad throw if one was to pass away.
Therefore one shouldn't even entertain such thoughts, let alone doing it and all...