File tree Expand file tree Collapse file tree
wfcommons/wfbench/translator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ def translate(self, output_folder: pathlib.Path) -> None:
9595 def _prep_commands (self , output_folder : pathlib .Path ) -> None :
9696 self .task_commands = {}
9797
98-
98+
9999
100100 for task in self .tasks .values ():
101101 # input_files = [str(output_folder.joinpath(f"data/{f.file_id}")) for f in task.input_files]
@@ -117,12 +117,17 @@ def _prep_commands(self, output_folder: pathlib.Path) -> None:
117117 args .append (a )
118118
119119 command_str = " " .join ([str (program )] + args )
120- # Prepends { and } with \" (i.e. {hi} -> \"{hi\"}
121- # command_str = re.sub(r"(\{|\})", r"\"\1", command_str)
122- # Prepends txt filenames with absolute path
123- # command_str = re.sub(r"([\w\-]+\.txt)",
124- # lambda m: f"{self.input_file_directory.absolute().as_posix()}/{m.group(1)}",
125- # command_str)
120+
121+ # Escapes all double quotes
122+ command_str = command_str .replace ('"' , '\\ \\ "' )
123+
124+ # Wraps --output-files and --input-files arguments in double quotes
125+ command_str = re .sub (
126+ r'(--output-files) (\{.*\}) (--input-files) (\[.*?\])' ,
127+ lambda m : f'{ m .group (1 )} "{ m .group (2 )} " { m .group (3 )} "{ m .group (4 )} "' ,
128+ command_str
129+ )
130+
126131 self .task_commands [task .task_id ] = command_str
127132
128133
You can’t perform that action at this time.
0 commit comments