New submission from Nehal Patel <nehal.a...@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.

----------
components: IO
messages: 370804
nosy: Nehal Patel
priority: normal
severity: normal
status: open
title: Cannot pipe GzipFile into subprocess
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40885>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to