kovalensky / tmrr

A cli tool for extracting, comparing, and calculating file hashes for .torrent files compatible with the BitTorrent v2 protocol.
MIT License
32 stars 1 forks source link

return non-0 exit status on error(s) #7

Open eadmaster opened 5 months ago

eadmaster commented 5 months ago

e.g.

$ php tmrr.php e Denpa_Music_Collection_v1.0.torrent 

--- Unprocessed files: ---

File: Denpa_Music_Collection_v1.0.torrent 
Error type: This is an invalid hybrid or v2 torrent.
v1 torrents do not support displaying file hashes.

$ echo $?

0  # expecting non-0 exit code here
kovalensky commented 5 months ago

Hello, error status is always displayed in the end, before that, there could be some successful output from valid v2 files.

I'm not sure if it's necessary to send exit code here, but I'm open to suggestions.

eadmaster commented 5 months ago

i've found this is a very easy fix by adding to this line:

            exit(1); }

(die() always exit with a 0 status)