Skip to content

Commit

Permalink
fix: missing commands
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeAeich committed Aug 22, 2024
1 parent aaad8fb commit 46bbe2a
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions tesk/api/kubernetes/convert/executor_command_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
params
"""

import re
from typing import List

from tesk.api.ga4gh.tes.models import TesExecutor
Expand All @@ -18,8 +17,6 @@
class ExecutorCommandWrapper:
"""Wraps executor's command."""

SPECIAL_CHARS = re.compile(r"[ !\"#$&'()*;<>?\[\\`{|~\t\n]")

def __init__(self, executor: TesExecutor):
"""Initialize the wrapper."""
self.executor = executor
Expand All @@ -38,17 +35,7 @@ def get_commands_with_stream_redirects(self) -> List[str]:
result.append("/bin/sh")
result.append("-c")

command_parts = []

for command_part in self.executor.command:
command = ""
if self.SPECIAL_CHARS.search(command_part):
# Replace single quotes with '"'"'
if "'" in command_part:
replace_command_part = command_part.replace("'", "'\"'\"'")
# Quote the command part
command = f"'{replace_command_part}'"
command_parts.append(command)
command_parts = [" ".join(self.executor.command)]

if self.executor.stdin:
command_parts.append("<")
Expand All @@ -64,4 +51,4 @@ def get_commands_with_stream_redirects(self) -> List[str]:

result.append(" ".join(command_parts))

return result
return result

0 comments on commit 46bbe2a

Please sign in to comment.