From fd3de4099717041fa7d77ab5d42f2b103bc871a7 Mon Sep 17 00:00:00 2001 From: Nose Date: Wed, 21 Jan 2026 23:30:19 -0800 Subject: [PATCH] f --- scripts/bootstrap.py | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/scripts/bootstrap.py b/scripts/bootstrap.py index d180225..9593e60 100644 --- a/scripts/bootstrap.py +++ b/scripts/bootstrap.py @@ -87,18 +87,22 @@ def run(cmd: list[str], quiet: bool = False, debug: bool = False, cwd: Optional[ if debug: print(f"\n> {' '.join(cmd)}") + # Ensure subprocess uses the re-opened interactive stdin if we have one + stdin_handle = sys.stdin if not sys.stdin.isatty() or platform.system().lower() == "windows" else None + if quiet and not debug: subprocess.check_call( cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, cwd=str(cwd) if cwd else None, - env=env + env=env, + stdin=stdin_handle ) else: if not debug: print(f"> {' '.join(cmd)}") - subprocess.check_call(cmd, cwd=str(cwd) if cwd else None, env=env) + subprocess.check_call(cmd, cwd=str(cwd) if cwd else None, env=env, stdin=stdin_handle) REPO_URL = "https://code.glowers.club/goyimnose/Medios-Macina.git" @@ -516,13 +520,17 @@ def main() -> int: def _is_valid_mm_repo(p: Path) -> bool: return (p / "CLI.py").exists() and (p / "scripts").exists() - is_in_repo = _is_valid_mm_repo(repo_root) - - # If not in the parent of the script, check the current working directory - if not is_in_repo and _is_valid_mm_repo(Path.cwd()): - repo_root = Path.cwd() - script_dir = repo_root / "scripts" - is_in_repo = True + # If running from a pipe/standalone, don't auto-probe the current directory + # as a repo. This prevents "auto-choosing" existing folders in Web Installer mode. + if script_path is None: + is_in_repo = False + else: + is_in_repo = _is_valid_mm_repo(repo_root) + # If not in the parent of the script, check the current working directory + if not is_in_repo and _is_valid_mm_repo(Path.cwd()): + repo_root = Path.cwd() + script_dir = repo_root / "scripts" + is_in_repo = True if not args.quiet: print(f"Bootstrap script location: {script_dir}") @@ -1013,7 +1021,12 @@ def main() -> int: env.pop("PYTHONPATH", None) # We use sys.executable (the one running bootstrap.py) to run hydrusnetwork.py # This ensures it uses the same environment that started the bootstrap. - subprocess.check_call([sys.executable, str(hydrus_script), "--no-project-venv"], env=env) + # Pass sys.stdin to ensure the subprocess can talk to the terminal. + subprocess.check_call( + [sys.executable, str(hydrus_script), "--no-project-venv"], + env=env, + stdin=sys.stdin + ) except subprocess.CalledProcessError: print("\nHydrusNetwork setup exited with an error.") except Exception as e: