The legality of a sentence may be tested in a habeas corpus proceeding. When an order in such a proceeding directs the sentencing court to resentence the relator, such court *712is under the necessity of resentencing him within a reasonable time. If it fails to do so, the District Attorney is under a duty to make an application pursuant to article 78 of the Civil Practice Act for an order to compel the sentencing court to proceed with such resentencing and pronounce judgment (Matter of Hogan v. Bohan, 305 N. Y. 110). Here, we have been told, the term of imprisonment that might have been lawfully imposed has expired.
The order should be affirmed.
Lewis, Ch. J., Conway, Desmond, Dye, Fuld and Fboessel, JJ., concur in Per Curiam opinion; Van Voobhis, J., concurs in the result.
Order affirmed.