diff --git a/.github/actions/build_and_publish_pypi/action.yml b/.github/actions/build_and_publish_pypi/action.yml deleted file mode 100644 index 372b880c..00000000 --- a/.github/actions/build_and_publish_pypi/action.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2020-2024 The MathWorks, Inc. - -# Composite Action to Build and Publish in PyPi -name: Build and Publish in PyPi -runs: - using: "composite" - steps: - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: '3.8' - - - name: Install Python build dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install wheel - shell: bash - - - name: Build Source and Binary wheel distributions - run: python3 setup.py bdist_wheel sdist - shell: bash - - - name: Publish to PyPI. - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/matlab_proxy/app_state.py b/matlab_proxy/app_state.py index 42ae7523..6a86e50f 100644 --- a/matlab_proxy/app_state.py +++ b/matlab_proxy/app_state.py @@ -1427,11 +1427,26 @@ async def stop_matlab(self, force_quit=False): else: logger.debug("Sending HTTP request to stop the MATLAB process...") try: + import sys + # Send HTTP request await self.__send_stop_request_to_matlab() + # Close the stderr stream to prevent indefinite hanging on it due to a child + # process inheriting it, fixes https://github.com/mathworks/matlab-proxy/issues/44 + stderr_stream = matlab._transport.get_pipe_transport( + sys.stderr.fileno() + ) + if stderr_stream: + logger.debug( + "Closing matlab process stderr stream: %s", + stderr_stream, + ) + stderr_stream.close() + # Wait for matlab to shutdown gracefully await matlab.wait() + assert ( matlab.returncode == 0 ), "Failed to gracefully shutdown MATLAB via the embedded connector" diff --git a/setup.py b/setup.py index 75f928a7..acbbb82c 100644 --- a/setup.py +++ b/setup.py @@ -78,7 +78,7 @@ def run(self): setuptools.setup( name="matlab-proxy", - version="0.23.3", + version="0.23.4", url=config["doc_url"], author="The MathWorks, Inc.", author_email="cloud@mathworks.com",