This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess.run calling bash on windows10 cause 0x80070057 error when capture stdout with PIPE
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.6
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: SLAPaper, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2017-03-29 00:56 by SLAPaper, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg290762 - (view) Author: SLAPaper (SLAPaper) Date: 2017-03-29 00:56
print(subprocess.run("bash -c ls", shell=True, stdout=subprocess.PIPE, encoding='utf_16_le').stdout)
# 错误: 0x80070057
# error: 0x80070057

And the returncode is 4294967295.

OS: Simp-Chinese Win10; Bash on Windows(Ubuntu 14.04 LTS).
Python 3.5 and Python 3.6 produce the same issue.

While not capture stdout, the command works just fine and output the result onto screen.
msg290795 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2017-03-29 22:40
The initial release of WSL doesn't support passing non-console standard handles from Windows to Linux, or vice versa. It will work if you switch to a Windows Insider preview build. Otherwise you'll have to wait for the Windows 10 Creators Update. 

See the following video and blog post by Ben Hillis for a discussion of the architecture changes that were made to support this feature:

https://blogs.msdn.microsoft.com/wsl/2016/10/19/windows-and-ubuntu-interoperability
History
Date User Action Args
2022-04-11 14:58:44adminsetgithub: 74124
2017-03-29 22:46:43eryksunsetresolution: not a bug -> third party
2017-03-29 22:40:53eryksunsetstatus: open -> closed

nosy: + eryksun
messages: + msg290795

resolution: not a bug
stage: resolved
2017-03-29 00:56:07SLAPapercreate