@staticmethod
def sanitize_command(cmd: str) ->list:
    """
        Sanitizes the command into an array of arguments
        :param cmd: the command string
        :return: a list of tokens for the launcher
        """
    within_quote = False
    within_double_quote = False
    tokens = []
    accumulator = ''
    for c in cmd:
        if c == '"' and not within_quote:
            if within_double_quote:
                if len(accumulator) > 0:
                    tokens.append(accumulator)
                    accumulator = ''
                within_double_quote = False
            elif len(accumulator) == 0:
                within_double_quote = True
            else:
                accumulator += c
        elif c == "'" and not within_double_quote:
            if within_quote:
                if len(accumulator) > 0:
                    tokens.append(accumulator)
                    accumulator = ''
                within_quote = False
            elif len(accumulator) == 0:
                within_quote = True
            else:
                accumulator += c
        elif (c == ' ' or c == '\t' or c == '\n'
            ) and not within_double_quote and not within_quote:
            if len(accumulator) > 0:
                tokens.append(accumulator)
                accumulator = ''
        else:
            accumulator += c
    if len(accumulator) > 0:
        tokens.append(accumulator)
    return tokens
