Upon executing the warrant of attachment, the officer executing the warrant must keep the person in custody, bring him before the court or judge, and detain him until an order be made in the premises, unless the person arrested entitle himself to be discharged, as provided in the next section.