The provisions of the Code of Practice in Civil Cases shall apply to and govern summoning and coercing the attendance of witnesses and compelling them to testify in all prosecutions and all criminal or penal actions or proceedings, except that the attendance of witnesses residing in any part of the state may be coerced, and it shall never be necessary to tender to the witnesses any compensation for expenses or otherwise before process of contempt shall issue.