@@ -326,66 +326,32 @@ def _save_filenames(self):
326326 return clean
327327
328328 def _parse_windows_command (self ):
329- from subprocess import Popen , PIPE
330329 try :
331- p = Popen (['echo' , self .arguments ], stdin = PIPE , stdout = PIPE ,
332- stderr = PIPE , shell = True )
333- output , _ = p .communicate ()
334- from ctypes import cdll
335-
336- code_page = cdll .kernel32 .GetConsoleCP ()
337- if code_page == 0 :
338- os_encoding = os .getenv ('RIDE_ENCODING' , OUTPUT_ENCODING )
339- else :
340- os_encoding = 'cp' + str (code_page )
341- try :
342- output = output .decode (os_encoding )
343- except UnicodeDecodeError :
344- message_box = RIDEDialog (title = "UnicodeDecodeError" ,
345- message = f"An UnicodeDecodeError occurred when processing the Arguments."
346- f" The encoding used was '{ os_encoding } '. You may try to define the environment variable"
347- f" RIDE_ENCODING with a proper value. Other possibility, is to replace 'pythonw.exe' by "
348- f"'python.exe' in the Desktop Shortcut." , style = wx .OK | wx .ICON_ERROR )
349- message_box .ShowModal ()
350- output = str (output ).lstrip ("b\' " ).lstrip ('"' ).replace ('\\ r\\ n' , '' ).replace ('\' ' , '' ).\
351- replace ('\\ ""' , '\" ' ).strip ()
352- # print(f"DEBUG: run_profiles _parse_windows_command: output ={output}")
330+ output = self .arguments
353331 even = True
354332 counter = 0
355333 for idx in range (0 , len (output )):
356334 if output [idx ] == '"' :
357335 counter += 1
358336 even = counter % 2 == 0
359- # print(f"DEBUG: run_profiles loop({idx} counter:{counter}")
360- self ._defined_arguments = output .replace ('\' ' , '' )\
361- .replace ('\\ \\ ' , '\\ ' ).replace ('\\ r\\ n' , '' )
337+ self ._defined_arguments = output .replace ('\\ \\ ' , '\\ ' )
362338 if not even :
363339 self ._defined_arguments = self ._defined_arguments .rstrip ('"' )
364- except IOError :
340+ except Exception :
365341 pass
366-
367342 def _parse_posix_command (self ):
368- # print(f"DEBUG: run_profiles _parse_posix_command: ENTER self.arguments={self.arguments}")
369- from subprocess import Popen , PIPE
370343 try :
371- p = Popen (['echo ' + self .arguments .replace ('"' , '\\ "' )], stdin = PIPE , stdout = PIPE ,
372- stderr = PIPE , shell = True )
373- output , _ = p .communicate ()
374- # print(f"DEBUG: run_profiles _parse_posix_command: RAW output ={output}")
375- output = str (output ).lstrip ("b\' " ).replace ('\\ n' , '' ).rstrip ("\' " ).strip ()
376- # print(f"DEBUG: run_profiles _parse_posix_command: output ={output}")
344+ output = self .arguments
377345 even = True
378346 counter = 0
379347 for idx in range (0 , len (output )):
380348 if output [idx ] == '"' :
381349 counter += 1
382350 even = counter % 2 == 0
383- # print(f"DEBUG: run_profiles loop({idx} counter:{counter}")
384- self ._defined_arguments = output .replace ('\' ' , '' )\
385- .replace ('\\ \\ ' , '\\ ' ).replace ('\\ n' , '' )
351+ self ._defined_arguments = output .replace ('\\ \\ ' , '\\ ' )
386352 if not even :
387353 self ._defined_arguments = self ._defined_arguments .rstrip ('"' )
388- except IOError :
354+ except Exception :
389355 pass
390356
391357 @staticmethod
0 commit comments