4 ms·
> I'm not sure how much closer to describing your exact intent in English a language can get than: > successfully_made_executable = system 'chmod +x /us
by jrochkind1 5y ago
> I'm not sure how much closer to describing your exact intent in English a language can get than:
> successfully_made_executable = system 'chmod +x /usr/local/bin/hasura'
> abort 'Failed making CLI executable' unless successfully_made_executable
I guess, but if I was writing scripts like this, I'd really want to write a helper method something like:
def system_or(cmd, fail_msg)
system cmd || abort fail_msg
end
# and then
system_or 'chmod +x /usr/local/bin/hasura', 'Failed making CLI executable'
Instead of having to write every single `system` call as boilerplate two liners with an immediate-throwaway local var.