[issue37424] subprocess.run timeout does not function if shell=True and capture_output=True

2019-06-27 Thread haizaar


New submission from haizaar :

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 
<https://bugs.python.org/issue37424>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37424] subprocess.run timeout does not function if shell=True and capture_output=True

2019-06-27 Thread haizaar


haizaar  added the comment:

Thanks for looking at it.

My original code had "tar" running, which is a child of the shell as well... I 
assume running exec in the shell may help somewhat, but not a cure obviously.

I'm all for killing the process group. "Run something and get it's about" 
should be simple enough without requiring a programmer to know all POSIX 
process semantics.

--

___
Python tracker 
<https://bugs.python.org/issue37424>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26534] subprocess.check_output with shell=True ignores the timeout

2019-06-27 Thread haizaar


Change by haizaar :


--
nosy: +haizaar

___
Python tracker 
<https://bugs.python.org/issue26534>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30154] subprocess.run with stderr connected to a pipe won't timeout when killing a never-ending shell commanad

2019-06-27 Thread haizaar


Change by haizaar :


--
nosy: +haizaar

___
Python tracker 
<https://bugs.python.org/issue30154>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5115] Extend subprocess.kill to be able to kill process groups

2019-06-27 Thread haizaar


Change by haizaar :


--
nosy: +haizaar

___
Python tracker 
<https://bugs.python.org/issue5115>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com