Whenever the judge or chancellor, on issuing a writ of habeas corpus, shall be satisfied, by affidavit or otherwise, that the person unlawfully depriving another of his liberty has committed a crime in connection with such unlawful act, he may embody in the writ a warrant for the arrest of such person and have him brought up for examination at the hearing of the habeas corpus; and being satisfied, on the trial and examination, of the guilt of such person, the judge or chancellor shall commit him, or order his release on bail, to appear before the proper court to answer the charge.