I read your post, but I found it a bit difficult to understand the main point. Perhaps you wrote it in a hurry, frustrated with the computer. That happens a lot.
Let’s use a concrete example to clarify:
Create a temporary directory and navigate into it.
mkdir tmp
cd tmp
In another terminal, delete the directory.
rm -r tmp
Back in the first terminal, run the following command:
crystal eval 'Dir.glob("*")'
This results in a File::NotFoundError. Is this the issue you’re referring to?
If so, could you explain what behavior you would like to see in this situation?
If you really think it is a bug, you should report it and request a fix, rather than trying to work around it.
No, it does not change the working directory. But it queries the current working directory. If that path doesn’t exit, the method fails. Looks like a bug. Dir.glob should account for a non-existing working directory and handle that gracefully.
Great. I see that you have created issue in crystal for another case that is very similar. It would be helpful for everyone if you write an issue on this matter as well.
The Rails issue template will help you create an issues that are easy to understand.