cmd.run: add needs_user_terminal to unbreak sudo

This commit is contained in:
DavHau
2024-10-23 17:37:31 +07:00
parent 102ca452b0
commit 28026a9b92
3 changed files with 12 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ def pause_automounting(devices: list[Path]) -> Generator[None, None, None]:
str_devs = [str(dev) for dev in devices]
cmd = ["sudo", str(inhibit_path), "enable", *str_devs]
result = run(cmd, log=Log.BOTH, check=False)
result = run(cmd, log=Log.BOTH, check=False, needs_user_terminal=True)
if result.returncode != 0:
log.error("Failed to inhibit automounting")
yield None

View File

@@ -152,4 +152,9 @@ def flash_machine(
["nixpkgs#disko"],
disko_install,
)
run(cmd, log=Log.BOTH, error_msg=f"Failed to flash {machine}")
run(
cmd,
log=Log.BOTH,
error_msg=f"Failed to flash {machine}",
needs_user_terminal=True,
)