technopagan / adept-jpg-compressor

A Bash script to automate adaptive JPEG compression using common CLI tools
Other
377 stars 28 forks source link

Add exit code checking to functions without return values #20

Open technopagan opened 10 years ago

technopagan commented 10 years ago

Currenty, the functions calling upon ImageMagick commands assume that everything goes well within these commands. There is no return value we can unit-test easily.

What we should implement is checking for the exit state of each command and see if they are all Null (OK) and alternatively, abort execution as soon as one of them returns anything else but Null.

Of course, even when aborting, we will still be running cleanup in order not to leave any temporary files behind and we should use the opportunity to provide the user with helpful debugging information (Anything is better than some NonNull-error code!).