Until judgment is given on the return, the Court or Judge before whom any party may be brought on such writ may commit him to the custody of the Sheriff of the county, or place him in such care or under such custody as his age or circumstances may require.
Ca. Pen. Code § 1494