Upon arresting any defendant, on a bench warrant, to answer for any alleged misconduct, the sheriff shall keep such person in his actual custody, and shall bring him personally before the court issuing the warrant, and shall keep and detain him in his custody, until such court orders otherwise, or until the defendant is entitled to be discharged on bond.