Any party aggrieved by the judgment on the trial of a habeas corpus, shall have an appeal to the Supreme Court. If any person held in service by this state, or by the United States, should be discharged by any judge in vacation, or any court, on habeas corpus, the Attorney General or any district attorney, or any attorney duly authorized by the United States, may in like manner obtain an appeal to reverse the judgment by which such person was discharged.