If any convict, confined in any jail or in the penitentiary for a criminal offense, shall escape therefrom he may be pursued, retaken and imprisoned again, notwithstanding the term for which he was sentenced to be imprisoned may have expired at the time he shall be retaken, and shall remain so imprisoned until he shall have served as a convict the entire length of time which he would have been required to so serve had he not escaped, and until tried for such escape, or until discharged on a failure to prosecute therefor.