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: if debug:
print(f"\n> {' '.join(cmd)}") 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: if quiet and not debug:
subprocess.check_call( subprocess.check_call(
cmd, cmd,
stdout=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
cwd=str(cwd) if cwd else None, cwd=str(cwd) if cwd else None,
env=env env=env,
stdin=stdin_handle
) )
else: else:
if not debug: if not debug:
print(f"> {' '.join(cmd)}") 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" 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: def _is_valid_mm_repo(p: Path) -> bool:
return (p / "CLI.py").exists() and (p / "scripts").exists() return (p / "CLI.py").exists() and (p / "scripts").exists()
is_in_repo = _is_valid_mm_repo(repo_root) # 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 not in the parent of the script, check the current working directory if script_path is None:
if not is_in_repo and _is_valid_mm_repo(Path.cwd()): is_in_repo = False
repo_root = Path.cwd() else:
script_dir = repo_root / "scripts" is_in_repo = _is_valid_mm_repo(repo_root)
is_in_repo = True # 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: if not args.quiet:
print(f"Bootstrap script location: {script_dir}") print(f"Bootstrap script location: {script_dir}")
@@ -1013,7 +1021,12 @@ def main() -> int:
env.pop("PYTHONPATH", None) env.pop("PYTHONPATH", None)
# We use sys.executable (the one running bootstrap.py) to run hydrusnetwork.py # We use sys.executable (the one running bootstrap.py) to run hydrusnetwork.py
# This ensures it uses the same environment that started the bootstrap. # 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: except subprocess.CalledProcessError:
print("\nHydrusNetwork setup exited with an error.") print("\nHydrusNetwork setup exited with an error.")
except Exception as e: except Exception as e: