소스 검색

Fix 'Dictionary mismatch' error when very small dicts are used because the temporary file isn't written to disk before zstdcat gets executed

master
JustAnotherArchivist 2 년 전
부모
커밋
c50a8fd796
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. +5
    -1
      zstdwarccat

+ 5
- 1
zstdwarccat 파일 보기

@@ -47,10 +47,14 @@ if len(sys.argv) == 2:
d = get_dict(fp)
else:
d = get_dict(sys.stdin.buffer.raw)
with tempfile.NamedTemporaryFile() as dfp:
# The file must be written to the file system before zstdcat is executed. The most reliable way for that is to close the file. This requires manually deleting it at the end.
with tempfile.NamedTemporaryFile(delete = False) as dfp:
dfp.write(d)
try:
args = ['zstdcat', '-D', dfp.name]
if len(sys.argv) == 2:
args.append(sys.argv[1])
pzstd = subprocess.Popen(args)
pzstd.communicate()
finally:
os.remove(dfp.name)

불러오는 중...
취소
저장