The Crystal Programming Language Forum

Check result of FileUtils command

Hello, I have a question. Inside a function I would like to check the result of some FileUtils command, like FileUtils.rm_r, or as well some no FileUtils command like Dir.mkdir (for example impossible to make due to a rights problem)

Sorry that the documentation is not clear on this point. File operations raise subclasses of File::Error, more specifically: crystal/ at c783cc44e135bfbf8bb207baf8908d075720bade · crystal-lang/crystal · GitHub. If it doesn’t raise, then the operation succeeded. Hope this helps.