Skip to content

Commit ccd08cb

Browse files
committed
close socket on finally clause. Fixes #262
1 parent 8b88be2 commit ccd08cb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tika/tika.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,6 @@ def checkPortIsOpen(remoteServerHost=ServerHost, port = Port):
761761
return True
762762
else :
763763
return False
764-
sock.close()
765-
#FIXME: the above line is unreachable
766764

767765
except KeyboardInterrupt:
768766
print("You pressed Ctrl+C")
@@ -776,6 +774,9 @@ def checkPortIsOpen(remoteServerHost=ServerHost, port = Port):
776774
print("Couldn't connect to server")
777775
sys.exit()
778776

777+
finally:
778+
sock.close()
779+
779780
def main(argv=None):
780781
"""Run Tika from command line according to USAGE."""
781782
global Verbose

0 commit comments

Comments
 (0)