|
@@ -47,10 +47,14 @@ if len(sys.argv) == 2: |
|
|
d = get_dict(fp) |
|
|
d = get_dict(fp) |
|
|
else: |
|
|
else: |
|
|
d = get_dict(sys.stdin.buffer.raw) |
|
|
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) |
|
|
dfp.write(d) |
|
|
|
|
|
try: |
|
|
args = ['zstdcat', '-D', dfp.name] |
|
|
args = ['zstdcat', '-D', dfp.name] |
|
|
if len(sys.argv) == 2: |
|
|
if len(sys.argv) == 2: |
|
|
args.append(sys.argv[1]) |
|
|
args.append(sys.argv[1]) |
|
|
pzstd = subprocess.Popen(args) |
|
|
pzstd = subprocess.Popen(args) |
|
|
pzstd.communicate() |
|
|
pzstd.communicate() |
|
|
|
|
|
finally: |
|
|
|
|
|
os.remove(dfp.name) |