diff --git a/addons/document/content_index.py b/addons/document/content_index.py index 6d49a29873f..72cb8f6e163 100644 --- a/addons/document/content_index.py +++ b/addons/document/content_index.py @@ -165,11 +165,9 @@ class contentIndex(object): os.write(fd, content) os.close(fd) - fp = Popen(['file','-b','--mime',fname], shell=False, stdout=PIPE).stdout - try: - result = fp.read() - finally: - fp.close() + pop = Popen(['file','-b','--mime',fname], shell=False, stdout=PIPE) + (result, _) = pop.communicate() + mime2 = result.split(';')[0] self.__logger.debug('File gave us: %s', mime2) # Note that the temporary file still exists now.