def _extract_shell_info(line: str, env_vars: List[str]) -> Tuple[(str, str)]:
    if (not env_vars):
        return (DEFAULT_SHELL, DEFAULT_SHELL_OPTIONS)
    vars_string = env_vars[0]
    env = {}
    items = vars_string.split()
    index = 0
    while (index < len(items)):
        (key, value) = items[index].split('=')
        if (value.startswith("'") or value.startswith('"')):
            control_character = value[0]
            while (index < (len(items) - 1)):
                if (value[(- 1)] == control_character):
                    break
                index += 1
                value += (' ' + items[index])
            if (not (value[(- 1)] == control_character)):
                raise ConfigurationError(f'Config line {line} is corrupted. Cannot parse end {key}={value}')
        env[key] = value.strip('"\'')
        index += 1
    print(env)
    shell = env.pop('RSHELL', DEFAULT_SHELL)
    shell_options = env.pop('RSHELL_OPTS', DEFAULT_SHELL_OPTIONS)
    if env:
        raise ConfigurationError(f'Config line {line} contains unexpected env variables: {env}. Only RSHELL and RSHELL_OPTS can be used')
    return (shell, shell_options)
def _extract_shell_info(line: str, env_vars: List[str]) -> Tuple[(str, str)]:
    if (not env_vars):
        return (DEFAULT_SHELL, DEFAULT_SHELL_OPTIONS)
    vars_string = env_vars[0]
    env = {}
    items = vars_string.split()
    index = 0
    while (index < len(items)):
        (key, value) = items[index].split('=')
        if (value.startswith("'") or value.startswith('"')):
            control_character = value[0]
            while (index < (len(items) - 1)):
                if (value[(- 1)] == control_character):
                    break
                index += 1
                value += (' ' + items[index])
            if (not (value[(- 1)] == control_character)):
                raise ConfigurationError(f'Config line {line} is corrupted. Cannot parse end {key}={value}')
        env[key] = value.strip('"\)
        index += 1
    print(env)
    shell = env.pop('RSHELL', DEFAULT_SHELL)
    shell_options = env.pop('RSHELL_OPTS', DEFAULT_SHELL_OPTIONS)
    if env:
        raise ConfigurationError(f'Config line {line} contains unexpected env variables: {env}. Only RSHELL and RSHELL_OPTS can be used')
    return (shell, shell_options)