This commit is contained in:
2026-01-21 23:30:19 -08:00
parent 3ff751acc5
commit fd3de40997

View File

@@ -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: