A terminally ill Darlington man has narrowly avoided an immediate prison sentence after threatening a man with a gun following an argument.