@@ -99,27 +99,15 @@ defmodule Mix.Tasks.Deps.Clean do
99
99
paths
100
100
end
101
101
102
- defp maybe_warn_failed_file_deletion ( results , dependency ) when is_list ( results ) do
103
- messages =
104
- Enum . flat_map ( results , fn
105
- { :error , reason , file } ->
106
- [ "\t file: #{ file } , reason: #{ :file . format_error ( reason ) } " ]
107
-
108
- _ ->
109
- [ ]
110
- end )
111
-
112
- with [ _ | _ ] <- messages do
102
+ defp maybe_warn_failed_file_deletion ( result ) do
103
+ with { :error , reason , file } <- result do
113
104
Mix . shell ( ) . error (
114
- "warning: errors occurred while deleting files for dependency: #{ dependency } \n " <>
115
- Enum . join ( messages , " \n " )
105
+ "warning: could not delete file #{ Path . relative_to_cwd ( file ) } , " <>
106
+ "reason: #{ :file . format_error ( reason ) } "
116
107
)
117
108
end
118
109
end
119
110
120
- defp maybe_warn_failed_file_deletion ( result , dependency ) ,
121
- do: maybe_warn_failed_file_deletion ( [ result ] , dependency )
122
-
123
111
defp do_clean ( apps , deps , build_path , deps_path , build_only? ) do
124
112
shell = Mix . shell ( )
125
113
@@ -133,8 +121,7 @@ defmodule Mix.Tasks.Deps.Clean do
133
121
|> Path . join ( to_string ( app ) )
134
122
|> Path . wildcard ( )
135
123
|> maybe_warn_for_invalid_path ( app )
136
- |> Enum . map ( & File . rm_rf / 1 )
137
- |> maybe_warn_failed_file_deletion ( app )
124
+ |> Enum . map ( & ( & 1 |> File . rm_rf ( ) |> maybe_warn_failed_file_deletion ( ) ) )
138
125
139
126
# Remove everything from the source directory of dependencies.
140
127
# Skip this step if --build option is specified or if
@@ -145,7 +132,7 @@ defmodule Mix.Tasks.Deps.Clean do
145
132
deps_path
146
133
|> Path . join ( to_string ( app ) )
147
134
|> File . rm_rf ( )
148
- |> maybe_warn_failed_file_deletion ( app )
135
+ |> maybe_warn_failed_file_deletion ( )
149
136
end
150
137
end )
151
138
end
0 commit comments