[New-bugs-announce] [issue33282] Subprocess Popen communicate hung if stdin not given to Popen, even though script not expecting any input

Jatin Goel report at bugs.python.org
Sun Apr 15 07:25:34 EDT 2018


New submission from Jatin Goel <jatingoel1037 at gmail.com>:

Hi
needed a small help related to the subprocess module
I'm executing a powershell process using the subprocess module

process = subprocess.Popen(
    [
        'powershell.exe',
        script
    ],
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    shell=True
)

output, error = process.communicate()

but the call to the communicate method is getting hung on some machines, and not all

i tried to debug the subprocess module but couldn't find anything helpful

the script is not expecting any input from the user

on the machines where it failed, if I just add stdin=subprocess.PIPE argument, it works

process = subprocess.Popen(
    [
        'powershell.exe',
        script
    ],
    stdin=subprocess.PIPE,
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    shell=True
)

above works

----------
components: Windows
messages: 315317
nosy: JatinGoel, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Subprocess Popen communicate hung if stdin not given to Popen, even though script not expecting any input
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33282>
_______________________________________


More information about the New-bugs-announce mailing list