News for hackers. Stuff that matters.
Re:Shelling Out Sucks (2012) by eloisius on Tuesday May 12, 2015 @06:41AM (#9530717)
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.

There are no comments on this comment yet.