Diff

Differences From Artifact [7f053ee293]:

To Artifact [ce277262eb]:


   605    605   		}
   606    606   
   607    607   		set localcachefile [download $pathinfo(hostname) $pkgpathinfo(file_sha1)]
   608    608   
   609    609   		if {$mode == "write"} {
   610    610   			set tmplocalpath "${localpath}.[expr rand()][clock clicks]"
   611    611   
   612         -			catch {
          612  +			set failed 0
          613  +			if {[catch {
   613    614   				file mkdir [file dirname $localpath]
   614    615   				file copy -force -- $localcachefile $tmplocalpath
   615    616   
   616    617   				if {$pkgpathinfo(perms) == "x"} {
   617    618   					file attributes $tmplocalpath -permissions +x
   618    619   				}
   619    620   
   620    621   				file rename -force -- $tmplocalpath $localpath
          622  +			} err]} {
          623  +				set failed 1
   621    624   			}
   622    625   			catch {
   623    626   				file delete -force -- $tmplocalpath
   624    627   			}
          628  +
          629  +			if {$failed} {
          630  +				return -code error $err
          631  +			}
   625    632   
   626    633   			return $localpath
   627    634   		}
   628    635   
   629    636   		return $localcachefile
   630    637   	}
   631    638   }