1- import subprocess as _subprocess
2- import threading as _threading
1+ from subprocess import run as _subprocess__run
2+ from subprocess import CalledProcessError as _subprocess__CalledProcessError
3+ from subprocess import Popen as _subprocess__Popen
4+ from subprocess import PIPE as _subprocess__PIPE
5+ from threading import Thread as _threading__Thread
36
47from pmma .python_src .constants import Constants as _Constants
58from pmma .python_src .general import get_operating_system as _get_operating_system
@@ -36,7 +39,7 @@ def run(self, command, blocking=True, hide_window=True):
3639 self ._exit_code = None
3740 self ._result = None
3841
39- self ._thread = _threading . Thread (target = self ._run , args = (command , hide_window ,))
42+ self ._thread = _threading__Thread (target = self ._run , args = (command , hide_window ,))
4043 self ._thread .name = "Executor:Execution_Thread"
4144 if blocking is False :
4245 self ._thread .daemon = True
@@ -54,9 +57,9 @@ def _run(self, command, hide_window):
5457 try :
5558 if command_type == list or command_type == tuple :
5659 if hide_window and _get_operating_system () == _Constants .WINDOWS :
57- result = _subprocess . run (command , capture_output = True , text = True , creationflags = _Constants .CREATE_NO_WINDOW )
60+ result = _subprocess__run (command , capture_output = True , text = True , creationflags = _Constants .CREATE_NO_WINDOW )
5861 else :
59- result = _subprocess . run (command , capture_output = True , text = True )
62+ result = _subprocess__run (command , capture_output = True , text = True )
6063 else :
6164 self ._logger .log_development ("You are not using an array of arguments as your command. \
6265 This has the potential to be less secure, especially when using the user's input as a \
@@ -65,13 +68,13 @@ def _run(self, command, hide_window):
6568 its arguments, leading to unsecure commands being run on the host system!" )
6669
6770 if hide_window and _get_operating_system () == _Constants .WINDOWS :
68- result = _subprocess . run (command , shell = True , capture_output = True , text = True , creationflags = _Constants .CREATE_NO_WINDOW )
71+ result = _subprocess__run (command , shell = True , capture_output = True , text = True , creationflags = _Constants .CREATE_NO_WINDOW )
6972 else :
70- result = _subprocess . run (command , shell = True , capture_output = True , text = True )
73+ result = _subprocess__run (command , shell = True , capture_output = True , text = True )
7174
7275 self ._result = result .stdout
7376 self ._exit_code = result .returncode
74- except _subprocess . CalledProcessError as result :
77+ except _subprocess__CalledProcessError as result :
7578 self ._result = result .output
7679 self ._exit_code = result .returncode
7780
@@ -124,7 +127,7 @@ def run(self, command, hide_window=True):
124127 self ._exit_code = None
125128 self ._result = ""
126129
127- self ._thread = _threading . Thread (target = self ._update_result , args = (command , hide_window ,))
130+ self ._thread = _threading__Thread (target = self ._update_result , args = (command , hide_window ,))
128131 self ._thread .daemon = True
129132 self ._thread .name = "AdvancedExecutor:Execution_Thread"
130133 self ._thread .start ()
@@ -156,9 +159,9 @@ def _run(self, command, hide_window):
156159 command_type = type (command )
157160 if command_type == list or command_type == tuple :
158161 if hide_window and _get_operating_system () == _Constants .WINDOWS :
159- process = _subprocess . Popen (command , stdout = _subprocess . PIPE , text = True , creationflags = _Constants .CREATE_NO_WINDOW )
162+ process = _subprocess__Popen (command , stdout = _subprocess__PIPE , text = True , creationflags = _Constants .CREATE_NO_WINDOW )
160163 else :
161- process = _subprocess . Popen (command , stdout = _subprocess . PIPE , text = True )
164+ process = _subprocess__Popen (command , stdout = _subprocess__PIPE , text = True )
162165 else :
163166 self ._logger .log_development ("You are not using an array of arguments as your command. \
164167 This has the potential to be less secure, especially when using the user's input as a \
@@ -167,9 +170,9 @@ def _run(self, command, hide_window):
167170 its arguments, leading to unsecure commands being run on the host system!" )
168171
169172 if hide_window and _get_operating_system () == _Constants .WINDOWS :
170- process = _subprocess . Popen (command , stdout = _subprocess . PIPE , shell = True , text = True , creationflags = _Constants .CREATE_NO_WINDOW )
173+ process = _subprocess__Popen (command , stdout = _subprocess__PIPE , shell = True , text = True , creationflags = _Constants .CREATE_NO_WINDOW )
171174 else :
172- process = _subprocess . Popen (command , stdout = _subprocess . PIPE , shell = True , text = True )
175+ process = _subprocess__Popen (command , stdout = _subprocess__PIPE , shell = True , text = True )
173176
174177 result = ""
175178 while True :
0 commit comments