Finely chop onion and chilli, fry for a couple of minutes on preheated olive oil with a pinch of salt. Add the rice and coat evenly with oil, then add wine and simmer for 2 minutes.
Add rosemary and pepper and start to pour the water one ladle after another when rice absorbs the liquid. Continue until the rice will become al dente, adding the cream instead of the last portion of water.
Add the pesto and heat everything for a while, season to perfection. Turn off the heat, add butter and stir thoroughly. Serve immediately.