Nothing contained in this chapter shall be so construed as to restrain the power of any court to issue a writ of habeas corpus, whenever necessary to bring before them any prisoner for trial, in any criminal case lawfully pending in the same court, or to bring in any prisoner to be examined as a witness in any suit or proceeding, civil or criminal, pending in the court, whenever they shall think the personal attendance and examination of the witness necessary for the attainment of justice.
R.I. Gen. Laws § 10-9-32