Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_subprocess.py: 0%

9 statements  

« prev     ^ index     » next       coverage.py v7.0.1, created at 2022-12-25 06:11 +0000

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 

12import subprocess 

13import sys 

14import io 

15 

16 

17class 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 

28subprocess.Popen = Popen