taintedzodiac / relaymyhome

(MacOS) Nintendo 3DS StreetPass Automation
MIT License
107 stars 21 forks source link

Added error handling / cleanup #5

Closed andypiper closed 11 years ago

andypiper commented 11 years ago

Previously, if the script exited with an error or was interrupted, the original MAC address was not restored. Added a trap on SIGINT/TERM and refactored the cleanup code into a function to deal with this. Also now echo out the original MAC address when the script starts working.

taintedzodiac commented 11 years ago

Thanks much! Only thing that my system complained about was the comparison for "full," which was fixed by using [[ ]] notation instead of the singles.

andypiper commented 11 years ago

Yep, there was that one too but it wasn't fatal so I ignored it - I was more concerned that a user (ahem, me) might start the script, then cancel it for whatever reason, and not have the MAC reset afterwards. Nice work on the base script though!

taintedzodiac commented 11 years ago

It certainly is a better method than restarting the machine. :+1: