kernel137/shavis

`--file` is not closing the file properly

Closed this issue · 2 comments

In shavis.py, lines 263-270, the script opens a file using the open() function to check if a file exists or not.
However, the script does not include a call to file.close() to properly close the file after it has been opened.

try: # opening file 
    file = open(str(filename))
except FileNotFoundError: # filter filename.ext existing -> exit
    print(f"Invalid file name: --file {filename}")
    print("File does not exist.")
    exit(1) # error exit
else:
    sha256 = hashfile(str(filename))

This could potentially result in unclosed file handles, which may lead to unexpected behavior.

I will resolve this within the next week of April or potentially sooner.

Thank you for catching this bug, I will resolve this ASAP.