fix: don't prompt users unless we have a TTY
This can break automated runs (which earlier worked) Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
b6cfedaa1c
commit
267e58a819
2 changed files with 3 additions and 2 deletions
|
|
@ -129,7 +129,7 @@ def get_root_connection():
|
|||
frappe.flags.root_login = (
|
||||
frappe.conf.get("mariadb_root_login")
|
||||
or frappe.conf.get("root_login")
|
||||
or input("Enter mysql super user [root]: ")
|
||||
or (sys.__stdin__.isatty() and input("Enter mysql super user [root]: "))
|
||||
or "root"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -60,13 +60,14 @@ def import_db_from_sql(source_sql=None, verbose=False):
|
|||
|
||||
def get_root_connection():
|
||||
if not frappe.local.flags.root_connection:
|
||||
import sys
|
||||
from getpass import getpass
|
||||
|
||||
if not frappe.flags.root_login:
|
||||
frappe.flags.root_login = (
|
||||
frappe.conf.get("postgres_root_login")
|
||||
or frappe.conf.get("root_login")
|
||||
or input("Enter postgres super user [postgres]: ")
|
||||
or (sys.__stdin__.isatty() and input("Enter postgres super user [postgres]: "))
|
||||
or "postgres"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue