Raymond Toy pushed to branch issue-373-handle-temp-files at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/code/extensions.lisp
    ... ... @@ -665,18 +665,20 @@
    665 665
       is used as a prefix for the name of the temporary directory.  The
    
    666 666
       directory and all its contents are automatically removed afterward."
    
    667 667
       (let ((err (gensym "ERR-")))
    
    668
    -    `(let (,err)
    
    668
    +    `(let (,dirname ,err)
    
    669 669
            (unwind-protect
    
    670
    -	(multiple-value-setq (,dirname ,err)
    
    671
    -	    (unix::unix-mkdtemp (concatenate 'string ,template
    
    672
    -					     "XXXXXX")))
    
    673
    -	  (unless ,dirname
    
    674
    -	    (error "Unable to create temp directory: ~A"
    
    675
    -		   (unix:get-unix-error-msg ,err)))
    
    676
    -	  (locally ,@decls
    
    677
    -	    ,@forms))
    
    678
    -     ;; Remove the temp directory and all its contents.  Is there a
    
    679
    -     ;; better way?
    
    680
    -     (ext:run-program "/bin/rm" (list "-rf" ,dirname)))))
    
    670
    +	    (progn
    
    671
    +	      (multiple-value-setq (,dirname ,err)
    
    672
    +		(unix::unix-mkdtemp (concatenate 'string ,template
    
    673
    +						 "XXXXXX")))
    
    674
    +	      (unless ,dirname
    
    675
    +		(error "Unable to create temp directory: ~A"
    
    676
    +		       (unix:get-unix-error-msg ,err)))
    
    677
    +	      (locally ,@decls
    
    678
    +		,@forms))
    
    679
    +	 ;; Remove the temp directory and all its contents.  Is there a
    
    680
    +	 ;; better way?
    
    681
    +	 (when ,dirname
    
    682
    +	   (ext:run-program "/bin/rm" (list "-rf" ,dirname)))))))
    
    681 683
          
    
    682 684