Skip to content

Commit 7c6e95f

Browse files
committed
Simply touch if file does not yet exist
1 parent 2b15408 commit 7c6e95f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/mix/test/test_helper.exs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ defmodule MixTest.Case do
177177
end
178178

179179
def ensure_touched(file, current) when is_binary(current) do
180-
ensure_touched(file, File.stat!(current).mtime)
180+
case File.stat(current) do
181+
{:ok, %{mtime: mtime}} -> ensure_touched(file, mtime)
182+
{:error, _} -> File.touch!(file)
183+
end
181184
end
182185

183186
def ensure_touched(file, current) when is_tuple(current) do

0 commit comments

Comments
 (0)