A Wigan man who stalked a woman for almost four months has narrowly avoided an immediate jail spell.