File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -2003,25 +2003,28 @@ fn readonly_registry_still_works() {
20032003
20042004    p. cargo ( "generate-lockfile" ) . run ( ) ; 
20052005    p. cargo ( "fetch --locked" ) . run ( ) ; 
2006-     chmod_readonly ( & paths:: home ( ) ) ; 
2006+     chmod_readonly ( & paths:: home ( ) ,   true ) ; 
20072007    p. cargo ( "build" ) . run ( ) ; 
2008+     // make sure we un-readonly the files afterwards so "cargo clean" can remove them (#6934) 
2009+     chmod_readonly ( & paths:: home ( ) ,  false ) ; 
20082010
2009-     fn  chmod_readonly ( path :  & Path )  { 
2011+ 
2012+     fn  chmod_readonly ( path :  & Path ,  readonly :  bool )  { 
20102013        for  entry in  t ! ( path. read_dir( ) )  { 
20112014            let  entry = t ! ( entry) ; 
20122015            let  path = entry. path ( ) ; 
20132016            if  t ! ( entry. file_type( ) ) . is_dir ( )  { 
2014-                 chmod_readonly ( & path) ; 
2017+                 chmod_readonly ( & path,  readonly ) ; 
20152018            }  else  { 
2016-                 set_readonly ( & path) ; 
2019+                 set_readonly ( & path,  readonly ) ; 
20172020            } 
20182021        } 
2019-         set_readonly ( path) ; 
2022+         set_readonly ( path,  readonly ) ; 
20202023    } 
20212024
2022-     fn  set_readonly ( path :  & Path )  { 
2025+     fn  set_readonly ( path :  & Path ,   readonly :   bool )  { 
20232026        let  mut  perms = t ! ( path. metadata( ) ) . permissions ( ) ; 
2024-         perms. set_readonly ( true ) ; 
2027+         perms. set_readonly ( readonly ) ; 
20252028        t ! ( fs:: set_permissions( path,  perms) ) ; 
20262029    } 
20272030} 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments