prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Hooks: Runtime hook for subprocess block launching standalone cmd
  <!--
  Welcome to the PyInstaller issue tracker! Before creating an issue, please heed the following:
  
  1. This tracker should only be used to report bugs and request features / enhancements to PyInstaller
      - For questions and general support, use the discussions forum.
  2. Use the search function before creating a new issue. Duplicates will be closed and directed to
     the original discussion.
  3. When making a bug report, make sure you provide all required information. The easier it is for
     maintainers to reproduce, the faster it'll be fixed.
  -->
  
  <!-- +++ ONLY TEXT +++ DO NOT POST IMAGES +++ -->
  
  ## Description of the issue
  In windowed build using `PySide2`,  `subprocess.Popen(["cmd"])` no longer work (cmd open then close immediately). I figured out that the issue come from the subprocess hook (since v4.8, pr #6364). If I comment out this file, `cmd` start showing again and stay alive.
  
  ### Context information (for bug reports)
  
  * Output of `pyinstaller --version`: ```5.4.1```
  * Version of Python: 3.7 / 3.8 / 3.9 / 3.10
  * Platform: Windows
  * How you installed Python: python.org/downloads
  * Did you also try this on another platform? Does it work there? → not relevant on other platform.
  
  ### A minimal example program which shows the error
  A cmd shows up at start, if you comment the hook it stays alive, if you don't the cmd disappear instantly.
  
  ```
  import subprocess
  import sys
  
  from PySide2 import QtWidgets
  
  class CmdExemple(QtWidgets.QMainWindow):
      def __init__(self):
          super().__init__()
          p = subprocess.Popen(["cmd"])
  
  if __name__ == "__main__":
      app = QtWidgets.QApplication(sys.argv)
      window = CmdExemple()
      window.show()
      exitCode = app.exec_()
      sys.exit(exitCode)
  ```
  
  
  </issue>
  <code>
  [start of PyInstaller/hooks/rthooks/pyi_rth_subprocess.py]
  1 #-----------------------------------------------------------------------------
  2 # Copyright (c) 2021-2022, PyInstaller Development Team.
  3 #
  4 # Licensed under the Apache License, Version 2.0 (the "License");
  5 # you may not use this file except in compliance with the License.
  6 #
  7 # The full license is in the file COPYING.txt, distributed with this software.
  8 #
  9 # SPDX-License-Identifier: Apache-2.0
  10 #-----------------------------------------------------------------------------
  11 
  12 import subprocess
  13 import sys
  14 import io
  15 
  16 
  17 class Popen(subprocess.Popen):
  18 
  19     # In windowed mode, force any unused pipes (stdin, stdout and stderr) to be DEVNULL instead of inheriting the
  20     # invalid corresponding handles from this parent process.
  21     if sys.platform == "win32" and not isinstance(sys.stdout, io.IOBase):
  22 
  23         def _get_handles(self, stdin, stdout, stderr):
  24             stdin, stdout, stderr = (subprocess.DEVNULL if pipe is None else pipe for pipe in (stdin, stdout, stderr))
  25             return super()._get_handles(stdin, stdout, stderr)
  26 
  27 
  28 subprocess.Popen = Popen
  29
  [end of PyInstaller/hooks/rthooks/pyi_rth_subprocess.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/PyInstaller/hooks/rthooks/pyi_rth_subprocess.py b/PyInstaller/hooks/rthooks/pyi_rth_subprocess.py
  deleted file mode 100644
  --- a/PyInstaller/hooks/rthooks/pyi_rth_subprocess.py
  +++ /dev/null
  @@ -1,28 +0,0 @@
  -#-----------------------------------------------------------------------------
  -# Copyright (c) 2021-2022, PyInstaller Development Team.
  -#
  -# Licensed under the Apache License, Version 2.0 (the "License");
  -# you may not use this file except in compliance with the License.
  -#
  -# The full license is in the file COPYING.txt, distributed with this software.
  -#
  -# SPDX-License-Identifier: Apache-2.0
  -#-----------------------------------------------------------------------------
  -
  -import subprocess
  -import sys
  -import io
  -
  -
  -class Popen(subprocess.Popen):
  -
  -    # In windowed mode, force any unused pipes (stdin, stdout and stderr) to be DEVNULL instead of inheriting the
  -    # invalid corresponding handles from this parent process.
  -    if sys.platform == "win32" and not isinstance(sys.stdout, io.IOBase):
  -
  -        def _get_handles(self, stdin, stdout, stderr):
  -            stdin, stdout, stderr = (subprocess.DEVNULL if pipe is None else pipe for pipe in (stdin, stdout, stderr))
  -            return super()._get_handles(stdin, stdout, stderr)
  -
  -
  -subprocess.Popen = Popen
  
verification_info: {"golden_diff": "diff --git a/PyInstaller/hooks/rthooks/pyi_rth_subprocess.py b/PyInstaller/hooks/rthooks/pyi_rth_subprocess.py\ndeleted file mode 100644\n--- a/PyInstaller/hooks/rthooks/pyi_rth_subprocess.py\n+++ /dev/null\n@@ -1,28 +0,0 @@\n-#-----------------------------------------------------------------------------\n-# Copyright (c) 2021-2022, PyInstaller Development Team.\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-#\n-# The full license is in the file COPYING.txt, distributed with this software.\n-#\n-# SPDX-License-Identifier: Apache-2.0\n-#-----------------------------------------------------------------------------\n-\n-import subprocess\n-import sys\n-import io\n-\n-\n-class Popen(subprocess.Popen):\n-\n-    # In windowed mode, force any unused pipes (stdin, stdout and stderr) to be DEVNULL instead of inheriting the\n-    # invalid corresponding handles from this parent process.\n-    if sys.platform == \"win32\" and not isinstance(sys.stdout, io.IOBase):\n-\n-        def _get_handles(self, stdin, stdout, stderr):\n-            stdin, stdout, stderr = (subprocess.DEVNULL if pipe is None else pipe for pipe in (stdin, stdout, stderr))\n-            return super()._get_handles(stdin, stdout, stderr)\n-\n-\n-subprocess.Popen = Popen\n", "issue": "Hooks: Runtime hook for subprocess block launching standalone cmd\n<!--\r\nWelcome to the PyInstaller issue tracker! Before creating an issue, please heed the following:\r\n\r\n1. This tracker should only be used to report bugs and request features / enhancements to PyInstaller\r\n    - For questions and general support, use the discussions forum.\r\n2. Use the search function before creating a new issue. Duplicates will be closed and directed to\r\n   the original discussion.\r\n3. When making a bug report, make sure you provide all required information. The easier it is for\r\n   maintainers to reproduce, the faster it'll be fixed.\r\n-->\r\n\r\n<!-- +++ ONLY TEXT +++ DO NOT POST IMAGES +++ -->\r\n\r\n## Description of the issue\r\nIn windowed build using `PySide2`,  `subprocess.Popen([\"cmd\"])` no longer work (cmd open then close immediately). I figured out that the issue come from the subprocess hook (since v4.8, pr #6364). If I comment out this file, `cmd` start showing again and stay alive.\r\n\r\n### Context information (for bug reports)\r\n\r\n* Output of `pyinstaller --version`: ```5.4.1```\r\n* Version of Python: 3.7 / 3.8 / 3.9 / 3.10\r\n* Platform: Windows\r\n* How you installed Python: python.org/downloads\r\n* Did you also try this on another platform? Does it work there? \u2192 not relevant on other platform.\r\n\r\n### A minimal example program which shows the error\r\nA cmd shows up at start, if you comment the hook it stays alive, if you don't the cmd disappear instantly.\r\n\r\n```\r\nimport subprocess\r\nimport sys\r\n\r\nfrom PySide2 import QtWidgets\r\n\r\nclass CmdExemple(QtWidgets.QMainWindow):\r\n    def __init__(self):\r\n        super().__init__()\r\n        p = subprocess.Popen([\"cmd\"])\r\n\r\nif __name__ == \"__main__\":\r\n    app = QtWidgets.QApplication(sys.argv)\r\n    window = CmdExemple()\r\n    window.show()\r\n    exitCode = app.exec_()\r\n    sys.exit(exitCode)\r\n```\r\n\n", "before_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2021-2022, PyInstaller Development Team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#\n# SPDX-License-Identifier: Apache-2.0\n#-----------------------------------------------------------------------------\n\nimport subprocess\nimport sys\nimport io\n\n\nclass Popen(subprocess.Popen):\n\n    # In windowed mode, force any unused pipes (stdin, stdout and stderr) to be DEVNULL instead of inheriting the\n    # invalid corresponding handles from this parent process.\n    if sys.platform == \"win32\" and not isinstance(sys.stdout, io.IOBase):\n\n        def _get_handles(self, stdin, stdout, stderr):\n            stdin, stdout, stderr = (subprocess.DEVNULL if pipe is None else pipe for pipe in (stdin, stdout, stderr))\n            return super()._get_handles(stdin, stdout, stderr)\n\n\nsubprocess.Popen = Popen\n", "path": "PyInstaller/hooks/rthooks/pyi_rth_subprocess.py"}]}