classification
Title: Subprocess Popen communicate hung if stdin not given to Popen, even though script not expecting any input
Type: Stage: resolved
Components: Windows Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: JatinGoel, corona10, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2018-04-15 11:25 by JatinGoel, last changed 2019-09-14 10:01 by corona10. This issue is now closed.

Messages (2)
msg315317 - (view) Author: Jatin Goel (JatinGoel) Date: 2018-04-15 11:25
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
msg352424 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2019-09-14 10:01
I would like to recommend this kind of question should be discussed at comp.lang.python mailing list.
If cpython bug is detected from this issue.
Please reopen this issue.

Thanks!
History
Date User Action Args
2019-09-14 10:01:08corona10setstatus: open -> closed

nosy: + corona10
messages: + msg352424

resolution: not a bug
stage: resolved
2018-04-15 11:25:33JatinGoelcreate