The court to which the petition is presented shall grant the rule, returnable at some convenient time, unless the case is one requiring the petitioner's imprisonment, shall discharge the petitioner pending the hearing of said rule, upon his paying the fees due the jailer, if any, and upon his entering such security for his appearance, surrender, and compliance with the decrees of the court, and his requirement of this act, as the court shall deem requisite.
39 P.S. § 5