This innocuous code:
Will not raise if
- Doesn't exist; or
- Cannot be removed because the directory is not empty.
Instead it returns an array of directories it failed to remove.
If you want an exception here, (because why wouldn't you?), then use
Dir.rmdir which behaves as one would expect.
The rationale for this insane decision is recorded here. Typically Ruby
raises in these sorts of situations IMO, so this email thread is good proof that you should keep a language’s stdlib small, and keep the list of people who can commit (and who decide how it works and what is in it) small.