diff --git a/lib/thor/actions/empty_directory.rb b/lib/thor/actions/empty_directory.rb index 2e544a117..820ca0220 100644 --- a/lib/thor/actions/empty_directory.rb +++ b/lib/thor/actions/empty_directory.rb @@ -112,11 +112,18 @@ def invoke_with_conflict_check(&block) if exists? on_conflict_behavior(&block) else - say_status :create, :green yield unless pretend? + say_status :create, :green end destination + rescue SystemCallError => e + raise e unless %w(Errno::EISDIR Errno::EEXIST).include?(e.class.name) + on_file_clash_behavior + end + + def on_file_clash_behavior + say_status :file_clash, :red end # What to do when the destination file already exists.