@@ -100,11 +100,8 @@ def __init__(
100
100
101
101
@staticmethod
102
102
def _check_output (cmd , ** kwargs ):
103
- output = check_output (cmd , ** kwargs )
104
- if isinstance (output , str ):
105
- return output
106
- else :
107
- return output .decode ('utf8' , 'replace' )
103
+ kwargs .setdefault ("text" , True )
104
+ return check_output (cmd , ** kwargs )
108
105
109
106
@staticmethod
110
107
def _runs_successful (cmd ):
@@ -130,60 +127,6 @@ def _format_for_python(param):
130
127
else :
131
128
return str (param )
132
129
133
- def _cmd_send_via_shell (self , paramlist ):
134
- # unused/deprecated function which send a command as shell command rather than as python code (see _cmd_send)
135
- # since it requires proper quoting for different shells, it's much more sensitive and complex than sending
136
- # poor python code
137
- def _powershell_quote (param ):
138
- if '"' in param or "'" in param or " " in param :
139
- # we need to replace single and double quotes be two double quotes, but if we are inside a string,
140
- # we need to prepend a backslash to the double quote. Otherwise it will get removed
141
- quoted = ""
142
- in_string = False
143
- for idx , c in enumerate (param ):
144
- prev_c = None if idx == 0 else param [idx - 1 ]
145
- next_c = None if idx == len (param ) - 1 else param [idx + 1 ]
146
- if c == '"' and prev_c != "\\ " :
147
- in_string = not in_string
148
- quoted += '"' * 2
149
- continue
150
- if c == "'" :
151
- if in_string :
152
- quoted += '\\ "' * 2
153
- else :
154
- quoted += '"' * 2
155
- continue
156
- quoted += c
157
- return "'" + quoted + "'"
158
- else :
159
- return param
160
-
161
- def _cmd_quote (param ):
162
- if "'" in param :
163
- tmp = param .strip () # if already double quoted we do not need to quote
164
- if tmp [0 ] == '"' and tmp [- 1 ] == '"' :
165
- return tmp
166
- else :
167
- return '"' + tmp + '"'
168
- else :
169
- return param
170
-
171
- if self ._win :
172
- if self .is_powershell :
173
- paramlist = [_powershell_quote (p ) for p in paramlist ]
174
- else :
175
- paramlist = [_cmd_quote (p ) for p in paramlist ]
176
- else :
177
- paramlist = [shlex .quote (p ) for p in paramlist ]
178
-
179
- full_list = [self .python_path , "-m" , self .package_name ] + paramlist
180
- if self .join_params :
181
- cmd = self .shell + self .args + [" " .join (full_list )]
182
- else :
183
- cmd = self .shell + self .args + full_list
184
-
185
- return self ._check_output (cmd )
186
-
187
130
def _cmd_start_windows_no_breakaway (self , cmd_args , py_cmd , cmd ):
188
131
# if windows platform doesn't support breakaway flag (e.g. Github Runner)
189
132
# we need to start a detached process (as work-a-round), the runs until the
0 commit comments