Я хочу автоматизировать команду настройки flutterfire с помощью подпроцесса Python.Popen, но он останавливается при выборе проекта Firebase.
Аргумент Popen, cwd, — это адрес файла, в котором вы хотите выполнить команду.
Код: Выделить всё
configure = subprocess.Popen(
"flutterfire configure",
shell = True,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
cwd = path
)
run_command_configure = True
while run_command_configure:
line_configure = configure.stdin.readline().decode().strip()
print(line_configure)
if "Select" in line_configure: configure.stdin.write("\n".encode())
if "Which platforms" in line_configure: configure.stdin.write("\n".encode())
if "Which Android application id" in line_configure:
#dir is directory name
dir += ".app\n"
configure.stdin.write(dir.encode())
configure.stdin.flush()
if "Learn" in line_configure: run_command_configure = False
Я нашел 1 Firebase проекты.
? Выберите проект Firebase, чтобы настроить приложение Flutter с помощью ›
❯ project-b82d2 (проект)
Подробнее здесь: https://stackoverflow.com/questions/791 ... cess-popen