3 ms·
I don't disagree that shelling out sucks, but the entire silent failure scenario in their example is the result of using the explicit to_i conversion method. Us
by eloisius 11y ago
I don't disagree that shelling out sucks, but the entire silent failure scenario in their example is the result of using the explicit to_i conversion method. Using to_i on an inconsistent data source is always prone to failure because of how it defaults to 0.
Integer(`find #{dir} -type f -print0 | xargs -0 grep foo | wc -l`)
is unlikely to fail because of bad input.
- deleted 11y ago[deleted]