diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d029c68..1ea56e3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-22.04, windows-latest] - python: ['3.7', '3.8', '3.9', '3.10'] + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] include: - os: ubuntu-20.04 python: '3.6' diff --git a/CODEOWNERS b/CODEOWNERS deleted file mode 100644 index bbfd6e0..0000000 --- a/CODEOWNERS +++ /dev/null @@ -1,2 +0,0 @@ -# This file was generated by https://github.com/audrow/update-ros2-repos -* @wjwwood diff --git a/osrf_pycommon/process_utils/execute_process_nopty.py b/osrf_pycommon/process_utils/execute_process_nopty.py index fd22aee..65a7ec1 100644 --- a/osrf_pycommon/process_utils/execute_process_nopty.py +++ b/osrf_pycommon/process_utils/execute_process_nopty.py @@ -130,18 +130,14 @@ def yield_to_stream(data, stream): def _execute_process_nopty(cmd, cwd, env, shell, stderr_to_stdout=True): - if stderr_to_stdout: - p = Popen(cmd, - stdin=PIPE, stdout=PIPE, stderr=STDOUT, - cwd=cwd, env=env, shell=shell, close_fds=False) - else: - p = Popen(cmd, - stdin=PIPE, stdout=PIPE, stderr=PIPE, - cwd=cwd, env=env, shell=shell, close_fds=False) - - # Left over data from read which isn't a complete line yet - left_overs = {p.stdout: b'', p.stderr: b''} + stderr = STDOUT if stderr_to_stdout else PIPE + with Popen( + cmd, stdin=PIPE, stdout=PIPE, stderr=stderr, + cwd=cwd, env=env, shell=shell, close_fds=False + ) as p: + # Left over data from read which isn't a complete line yet + left_overs = {p.stdout: b'', p.stderr: b''} - fds = list(filter(None, [p.stdout, p.stderr])) + fds = list(filter(None, [p.stdout, p.stderr])) - return _yield_data(p, fds, left_overs, os.linesep) + yield from _yield_data(p, fds, left_overs, os.linesep) diff --git a/stdeb.cfg b/stdeb.cfg index e1a8554..8aca44d 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,6 +1,6 @@ [DEFAULT] Depends3: python3-setuptools, python3-importlib-metadata Conflicts3: python-osrf-pycommon -Suite3: focal jammy bullseye bookworm +Suite3: focal jammy noble bookworm trixie X-Python3-Version: >= 3.8 No-Python2: diff --git a/tests/unit/test_process_utils/impl_aep_asyncio.py b/tests/unit/test_process_utils/impl_aep_asyncio.py index a478304..b3ab108 100644 --- a/tests/unit/test_process_utils/impl_aep_asyncio.py +++ b/tests/unit/test_process_utils/impl_aep_asyncio.py @@ -10,4 +10,5 @@ async def run(cmd, **kwargs): transport, protocol = await async_execute_process( create_protocol(), cmd, **kwargs) retcode = await protocol.complete + transport.close() return protocol.stdout_buffer, protocol.stderr_buffer, retcode