AaronV77 / Monday

Scripts that create aliases in order to be able to push and pull from a central storage server that you can have at home.
GNU General Public License v2.0
0 stars 0 forks source link

Command Failure #28

Closed AaronV77 closed 5 years ago

AaronV77 commented 5 years ago

A bug that I've been facing from the beginning but didn't really think about it is command failure. In some cases if a command fails and the scripts still work. This is wrong and should not work like this. Its very common to find in the tests but should still account for it.

AaronV77 commented 5 years ago

After looking into bash script error handling, it is apparent that I made a novice mistake. I need to be error handling everything in these scripts and I'm not. I need to make sure that a command is succeeding and not failing. There are times when commands fail and the script will continue to run when there were previous errors and will just cause more errors as the script continues.

After looking into bash script error handling, I will not be using the set -e as it looks like there is just to much inconsistency with the error handling in bash. So, I will create a cleanup function in both scripts and exit accordingly. In the heredocs, I will make sure to cleanup as well and will exit in a way that the script outside the heredoc will catch it and cleanup as well.

I will also be removing all the test output if statements since they clutter up the code and redo the tests to look for different things for succession and failures.

AaronV77 commented 5 years ago

Also I think if one test fails then the rest of the tests should not run. Maybe do something like what python does and tell how many succeeded, failed, and were skipped? Or don't say anything.