File tree 1 file changed +10
-7
lines changed
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() {
2003
2003
2004
2004
p. cargo ( "generate-lockfile" ) . run ( ) ;
2005
2005
p. cargo ( "fetch --locked" ) . run ( ) ;
2006
- chmod_readonly ( & paths:: home ( ) ) ;
2006
+ chmod_readonly ( & paths:: home ( ) , true ) ;
2007
2007
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 ) ;
2008
2010
2009
- fn chmod_readonly ( path : & Path ) {
2011
+
2012
+ fn chmod_readonly ( path : & Path , readonly : bool ) {
2010
2013
for entry in t ! ( path. read_dir( ) ) {
2011
2014
let entry = t ! ( entry) ;
2012
2015
let path = entry. path ( ) ;
2013
2016
if t ! ( entry. file_type( ) ) . is_dir ( ) {
2014
- chmod_readonly ( & path) ;
2017
+ chmod_readonly ( & path, readonly ) ;
2015
2018
} else {
2016
- set_readonly ( & path) ;
2019
+ set_readonly ( & path, readonly ) ;
2017
2020
}
2018
2021
}
2019
- set_readonly ( path) ;
2022
+ set_readonly ( path, readonly ) ;
2020
2023
}
2021
2024
2022
- fn set_readonly ( path : & Path ) {
2025
+ fn set_readonly ( path : & Path , readonly : bool ) {
2023
2026
let mut perms = t ! ( path. metadata( ) ) . permissions ( ) ;
2024
- perms. set_readonly ( true ) ;
2027
+ perms. set_readonly ( readonly ) ;
2025
2028
t ! ( fs:: set_permissions( path, perms) ) ;
2026
2029
}
2027
2030
}
You can’t perform that action at this time.
0 commit comments