[New-bugs-announce] [issue37424] subprocess.run timeout does not function if shell=True and capture_output=True
haizaar
report at bugs.python.org
Thu Jun 27 02:59:50 EDT 2019
New submission from haizaar <haizaar at gmail.com>:
Consider the following:
subprocess.run('sleep 10', shell=True, timeout=.1, capture_output=True)
It should raise after 0.1 seconds, but it does not - it waits 10 seconds till sleep finishes and only then raises "subprocess.TimeoutExpired: Command 'sleep 10' timed out after 0.1 seconds"
Removing 'capture_output=True' or converting command string to list (and removing shell=True) makes it work.
I'm using Python 3.7.3 on Ubuntu 16.04. Reproduces on official docker Python 3.7.3 image alpine3.8.
----------
components: Library (Lib)
messages: 346712
nosy: haizaar
priority: normal
severity: normal
status: open
title: subprocess.run timeout does not function if shell=True and capture_output=True
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37424>
_______________________________________
More information about the New-bugs-announce
mailing list