4 ms·
Throwing exceptions when a command returns non-zero exit status is very useful indeed. However, this isn't very different from using the shell's own && operator
by nimrody 14y ago
Throwing exceptions when a command returns non-zero exit status is very useful indeed. However, this isn't very different from using the shell's own && operator.
I still believe that wrapping shell commands with functions is the way to go. Functions can intelligently check their arguments and prevent propagation of dangerous (or otherwise obviously incorrect) arguments.
- justincormack 14y agoSurely implementing the shell commands natively is the way to go? This way you then have to parse the output of ifconfig, say. eg I have been doing this for Lua [1] you can do > i = nl.interfaces() > print(i.lo) lo Link encap:Local Loopback inet addr: 127.0.0.1/8 inet6 addr: ::1/128 UP LOOPBACK RUNNING LOWER_UP MTU: 16436 RX packets:261454 errors:0 dropped:0 TX packets:261454 errors:0 dropped:0 > print(i.eth0.macaddr) f0:da:f0:38:36:39 The functionality is now reasonably comprehensive, so you can rename interfaces, add addresses, although it is still a work in progress, as there is a fair amount of work involved as there is a lot of shell to implement, but it can be incrementally useful. [1] https://github.com/justincormack/ljsyscall https://github.com/justincormack/ljsyscall