tools: fix AttributeError: __exit__ on Python 2.6

Error occurs while dealing with Tar archives

PR-URL: https://github.com/nodejs/node/pull/17663
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Dmitriy Kasyanov authored and Myles Borins committed 2018-01-09 04:32:39 -05:00
1 parent 8d4fca3fb5
commit b89cda4cbd
1 file changed
+1 -1
+1 -1
View File
@@ -60,7 +60,7 @@ def unpack(packedfile, parent_path):
icuzip.extractall(parent_path)
return parent_path
elif tarfile.is_tarfile(packedfile):
with tarfile.TarFile.open(packedfile, 'r') as icuzip:
with contextlib.closing(tarfile.TarFile.open(packedfile, 'r')) as icuzip:
print ' Extracting tarfile: %s' % packedfile
icuzip.extractall(parent_path)
return parent_path