[New-bugs-announce] [issue40885] Cannot pipe GzipFile into subprocess
report at bugs.python.org
Fri Jun 5 20:56:53 EDT 2020
New submission from Nehal Patel <nehal.alum at gmail.com>:
The following code produces incorrect behavior:
with gzip.open("foo.gz") as gz:
res = subprocess.run("cat", stdin=gz, capture_output=True)
the contents of res.stdout are identical to the contents of "foo.gz"
It seems the subprocess somehow gets a hold of the underlying file descriptor pointing to the compressed file, and ends up being fed the compressed bytes.
nosy: Nehal Patel
title: Cannot pipe GzipFile into subprocess
versions: Python 3.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce