Trap signal properly when gets is running