Categories: CLI Utilities [Edit]

sysexits

https://rubygems.org/gems/sysexits
Have you ever wanted to call <code>exit()</code> with an error condition, but weren't sure what exit status to use? No? Maybe it's just me, then. Anyway, I was reading manpages late one evening before retiring to bed in my palatial estate in rural Oregon, and I stumbled across <code>sysexits(3)</code>. Much to my chagrin, I couldn't find a +sysexits+ for Ruby! Well, for the other 2 people that actually care about <code>style(9)</code> as it applies to Ruby code, now there is one! Sysexits is a *completely* *awesome* collection of human-readable constants for the standard (BSDish) exit codes, used as arguments to +exit+ to indicate a specific error condition to the parent process. It's so fantastically fabulous that you'll want to fork it right away to avoid being thought of as that guy that's still using Webrick for his blog. I mean, <code>exit(1)</code> is so passé! This is like the 14-point font of Systems Programming. Like the C header file from which this was derived (I mean forked, naturally), error numbers begin at <code>Sysexits::EX__BASE</code> (which is way more cool than plain old +64+) to reduce the possibility of clashing with other exit statuses that other programs may already return. The codes are available in two forms: as constants which can be imported into your own namespace via <code>include Sysexits</code>, or as <code>Sysexits::STATUS_CODES</code>, a Hash keyed by Symbols derived from the constant names. Allow me to demonstrate. First, the old way: exit( 69 ) Whaaa...? Is that a euphemism? What's going on? See how unattractive and... well, 1970 that is? We're not changing vaccuum tubes here, people, we're <em>building a totally-awesome future in the Cloud™!</em> include Sysexits exit EX_UNAVAILABLE Okay, at least this is readable to people who have used <code>fork()</code> more than twice, but you could do so much better! include Sysexits exit :unavailable...

Total

Ranking: 1,016 of 188,645
Downloads: 45,119,222

Daily

Ranking: 1,828 of 188,635
Downloads: 4,702

Depended by

RankDownloadsName
97347,724,242haml_lint
10,994242,419mongrel2
11,935204,684inversion
12,372190,869strelka
19,58483,199usaidwat
23,97961,040symphony
42,60027,757statsdserver
63,85116,035projecter
85,95110,236artifactory-cleaner
132,3224,685treequel-shell
134,7664,543cli_ui
137,0244,422rub

Depends on

RankDownloadsName
29937,687,145rspec
99434,284,425simplecov
177260,497,481rdoc
2,3119,064,059hoe
23,36363,334hoe-mercurial
31,20842,060hoe-highline

Owners

#GravatarHandle
1iconged
2iconmahlon