When any prisoner brought up on a habeas corpus is remanded to prison, it shall be the duty of the court remanding the prisoner to deliver to the sheriff, or other person to whose custody the prisoner is remanded, an order in writing, stating the cause of remanding the prisoner. If such prisoner obtains a second order of habeas corpus, it shall be the duty of such sheriff, or other person to whom the same is directed, to return therewith the order above stated; and if it appears that the prisoner was remanded for an offense adjudged not bailable, it shall be taken and received as conclusive, and the prisoner shall be remanded without further proceedings.
735 ILCS 5/10-126