The judge who issues an attachment under section 589.10 may also, at the same time or afterward, issue an order to the sheriff or other person to whom the attachment was directed, commanding the bringing of the petitioner before that judge immediately. After that, the petitioner must remain in the custody of the sheriff or other person until discharged, bailed, or remanded, as the judge may direct.