... |
... |
@@ -637,29 +637,34 @@ |
637
|
637
|
:decoding-error - How to handle decoding errors. See OPEN
|
638
|
638
|
:encoding-error - How to handle encoding errors. See OPEN"
|
639
|
639
|
(let ((abortp (gensym))
|
640
|
|
- (template (gensym "TEMPLATE-")))
|
|
640
|
+ (template (gensym "TEMPLATE-"))
|
|
641
|
+ (fd (gensym "FD-")))
|
641
|
642
|
|
642
|
643
|
`(let* ((,template (concatenate 'string
|
643
|
644
|
,template-prefix
|
644
|
645
|
"XXXXXX"))
|
645
|
|
- (,var (lisp::make-fd-stream (unix::unix-mkstemp ,template)
|
646
|
|
- :auto-close t
|
647
|
|
- :file ,template
|
648
|
|
- :output t
|
649
|
|
- :input t
|
650
|
|
- :element-type ',element-type
|
651
|
|
- :external-format ,external-format
|
652
|
|
- :decoding-error ,decoding-error
|
653
|
|
- :encoding-error ,encoding-error
|
654
|
|
- :buffering ,buffering))
|
655
|
|
- (,abortp t))
|
656
|
|
- ,@decls
|
657
|
|
- (unwind-protect
|
658
|
|
- (multiple-value-prog1
|
659
|
|
- (progn ,@forms)
|
660
|
|
- (setq ,abortp nil))
|
661
|
|
- (when ,var
|
662
|
|
- (close ,var :abort ,abortp))))))
|
|
646
|
+ (,fd (unix::unix-mkstemp ,template)))
|
|
647
|
+ (unless ,fd
|
|
648
|
+ (error "Could not create temporary file using template ~A"
|
|
649
|
+ ,template))
|
|
650
|
+ (let ((,var (lisp::make-fd-stream (unix::unix-mkstemp ,template)
|
|
651
|
+ :auto-close t
|
|
652
|
+ :file ,template
|
|
653
|
+ :output t
|
|
654
|
+ :input t
|
|
655
|
+ :element-type ',element-type
|
|
656
|
+ :external-format ,external-format
|
|
657
|
+ :decoding-error ,decoding-error
|
|
658
|
+ :encoding-error ,encoding-error
|
|
659
|
+ :buffering ,buffering))
|
|
660
|
+ (,abortp t))
|
|
661
|
+ ,@decls
|
|
662
|
+ (unwind-protect
|
|
663
|
+ (multiple-value-prog1
|
|
664
|
+ (progn ,@forms)
|
|
665
|
+ (setq ,abortp nil))
|
|
666
|
+ (when ,var
|
|
667
|
+ (close ,var :abort ,abortp)))))))
|
663
|
668
|
|
664
|
669
|
;; WITH-TEMPORARY-DIRECTORY -- Public
|
665
|
670
|
(defmacro with-temporary-directory ((var template-prefix)
|