If the prisoner is admitted to bail, and fails to appear and surrender himself according to the conditions of his bond or undertaking, the justice of the supreme court or county judge, by proper order, shall declare the bond forfeited and order his immediate arrest without warrant if he be within this state. Recovery may be had on such bond or undertaking in the name of the state as in the case of other bonds or undertakings given by the accused in criminal proceedings within this state.