Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with subprocess.Popen not producing any output #1766

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Src/StdLib/Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ def _get_handles(self, stdin, stdout, stderr):
errread, errwrite = _winapi.CreatePipe(None, 0)
errread, errwrite = Handle(errread), Handle(errwrite)
elif stderr == STDOUT:
errwrite = c2pwrite
errwrite = int(c2pwrite) # ironpython: cast to int to prevent closing in _make_inheritable
elif stderr == DEVNULL:
errwrite = msvcrt.get_osfhandle(self._get_devnull())
elif isinstance(stderr, int):
Expand Down
11 changes: 11 additions & 0 deletions Tests/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1710,4 +1710,15 @@ def test_ipy3_gh1649(self):
def test_map_type_int(self):
self.assertEqual(list(map(type, [0])), [type(0)])

def test_ipy3_gh1135(self):
# https://github.com/IronLanguages/ironpython3/issues/1135
import sys
import subprocess
with subprocess.Popen([sys.executable, '-c', 'print("aaa", end="")'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) as p:
out, err = p.communicate()

# ensure out is the expected value and not empty
self.assertEqual(out, b"aaa")


run_test(__name__)
Loading