Obedience to any order for the discharge of a prisoner, granted pursuant to the provisions of this chapter, may be enforced by the court granting such order, by attachment, in the same manner as herein provided in cases of failure to make return to a writ of habeas corpus, and with like effect in all respects.