@@ -99,27 +99,15 @@ defmodule Mix.Tasks.Deps.Clean do
9999 paths
100100 end
101101
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
113104 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 ) } "
116107 )
117108 end
118109 end
119110
120- defp maybe_warn_failed_file_deletion ( result , dependency ) ,
121- do: maybe_warn_failed_file_deletion ( [ result ] , dependency )
122-
123111 defp do_clean ( apps , deps , build_path , deps_path , build_only? ) do
124112 shell = Mix . shell ( )
125113
@@ -133,8 +121,7 @@ defmodule Mix.Tasks.Deps.Clean do
133121 |> Path . join ( to_string ( app ) )
134122 |> Path . wildcard ( )
135123 |> 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 ( ) ) )
138125
139126 # Remove everything from the source directory of dependencies.
140127 # Skip this step if --build option is specified or if
@@ -145,7 +132,7 @@ defmodule Mix.Tasks.Deps.Clean do
145132 deps_path
146133 |> Path . join ( to_string ( app ) )
147134 |> File . rm_rf ( )
148- |> maybe_warn_failed_file_deletion ( app )
135+ |> maybe_warn_failed_file_deletion ( )
149136 end
150137 end )
151138 end
0 commit comments