`touch` function errors where touch command in terminal works

I am unable to update the modification time of a folder using touch:

julia> mkdir("temp")

julia> mtime("temp")

julia> touch("temp")
ERROR: IOError: open("temp", 65, 438): illegal operation on a directory (EISDIR)
 [1] uv_error
   @ ./libuv.jl:100 [inlined]
 [2] open(path::String, flags::UInt16, mode::UInt16)
   @ Base.Filesystem ./filesystem.jl:121
 [3] touch(path::String)
   @ Base.Filesystem ./file.jl:458
 [4] top-level scope
   @ REPL[3]:1

This is consistent with the docstring. But running the touch system tool does the trick:

julia> run(`touch "temp"`)
Process(`touch temp`, ProcessExited(0))

julia> mtime("temp")

The fact that this command works on directories calls the error message “illegal operation on a directory” into question. Should the function not work more or less the same as the system tool?

I am running Julia 1.10 on Linux Debian in case it is relevant.