▲ | edoceo 3 days ago | |||||||||||||||||||||||||||||||||||||
What the hell. This is cool and all but I'm looking at it as a signal I should move up one tier in language (eg: to Perl, PHP, Python or Ruby) | ||||||||||||||||||||||||||||||||||||||
▲ | 0xbadcafebee 3 days ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||
Or go the other direction: stop trying to do fancy things and write simpler code that avoids errors.
A lot of programs will either produce valid output as STDOUT, or if they encounter an error, not produce STDOUT. So for the most part you just need to 1) look for any STDOUT at all, and then 2) filter it for the specific output you're looking for. For anything else, just die with an error. If you need to find out why it didn't run, re-run with DEBUG=1.Advanced diagnosis code won't make your program work better, but it will make it more complicated. Re-running with tracing enabled works just as well 99% of the time. | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
▲ | o11c 3 days ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||
I actually tried rewriting this in Python, but gave up since Python's startup latency is atrocious if you have even a few imports (and using a socket to a pre-existing server is fundamentally unable to preserve enough process context related to the terminal). Perl would probably be a better fit but it's $CURRENTYEAR and I've managed to avoid learning Perl every year so far, and I don't want to break my streak just for this. The Bash code is not only fast but pretty easy to understand (other than perhaps the header, which I never have to change). | ||||||||||||||||||||||||||||||||||||||
|