f
This commit is contained in:
@@ -69,14 +69,21 @@ def _ensure_interactive_stdin() -> None:
|
|||||||
if not sys.stdin.isatty():
|
if not sys.stdin.isatty():
|
||||||
try:
|
try:
|
||||||
if platform.system().lower() == "windows":
|
if platform.system().lower() == "windows":
|
||||||
sys.stdin = open("CONIN$", "r")
|
# Ensure the handle is actually opened for reading correctly
|
||||||
|
new_stdin = open("CONIN$", "r")
|
||||||
|
sys.stdin = new_stdin
|
||||||
else:
|
else:
|
||||||
sys.stdin = open("/dev/tty", "r")
|
sys.stdin = open("/dev/tty", "r")
|
||||||
except Exception:
|
|
||||||
pass
|
# Flush existing buffers to ensure clean state
|
||||||
|
if hasattr(sys.stdin, 'flush'):
|
||||||
|
sys.stdin.flush()
|
||||||
|
except Exception as e:
|
||||||
|
if "--debug" in sys.argv:
|
||||||
|
print(f"DEBUG: Failed to re-open stdin: {e}")
|
||||||
|
|
||||||
|
|
||||||
def run(cmd: list[str], quiet: bool = False, debug: bool = False, cwd: Optional[Path] = None) -> None:
|
def run(cmd: list[str], quiet: bool = False, debug: bool = False, cwd: Optional[Path] = None, env: Optional[dict[str, str]] = None) -> None:
|
||||||
if debug:
|
if debug:
|
||||||
print(f"\n> {' '.join(cmd)}")
|
print(f"\n> {' '.join(cmd)}")
|
||||||
|
|
||||||
@@ -85,12 +92,13 @@ def run(cmd: list[str], quiet: bool = False, debug: bool = False, cwd: Optional[
|
|||||||
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
|
||||||
)
|
)
|
||||||
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)
|
subprocess.check_call(cmd, cwd=str(cwd) if cwd else None, env=env)
|
||||||
|
|
||||||
|
|
||||||
REPO_URL = "https://code.glowers.club/goyimnose/Medios-Macina.git"
|
REPO_URL = "https://code.glowers.club/goyimnose/Medios-Macina.git"
|
||||||
@@ -787,14 +795,20 @@ def main() -> int:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if script_path is not None:
|
if is_in_repo and script_path is not None:
|
||||||
default_install = repo_root
|
default_install = repo_root
|
||||||
else:
|
else:
|
||||||
default_install = Path.cwd() / "Medios-Macina"
|
default_install = Path.cwd() / "Medios-Macina"
|
||||||
|
|
||||||
print("\n[WEB INSTALLER MODE]")
|
print("\n[WEB INSTALLER MODE]")
|
||||||
|
print(f"Current working directory: {Path.cwd()}")
|
||||||
print("Where would you like to install Medios-Macina?")
|
print("Where would you like to install Medios-Macina?")
|
||||||
install_dir_raw = input(f"Installation directory [{default_install}]: ").strip()
|
|
||||||
|
# Use sys.stdin.readline() to be more robust than input() in some terminal environments
|
||||||
|
sys.stdout.write(f"Installation directory [{default_install}]: ")
|
||||||
|
sys.stdout.flush()
|
||||||
|
install_dir_raw = sys.stdin.readline().strip()
|
||||||
|
|
||||||
if not install_dir_raw:
|
if not install_dir_raw:
|
||||||
install_path = default_install
|
install_path = default_install
|
||||||
else:
|
else:
|
||||||
@@ -992,7 +1006,14 @@ def main() -> int:
|
|||||||
hydrus_script = repo_root / "scripts" / "hydrusnetwork.py"
|
hydrus_script = repo_root / "scripts" / "hydrusnetwork.py"
|
||||||
if hydrus_script.exists():
|
if hydrus_script.exists():
|
||||||
try:
|
try:
|
||||||
subprocess.check_call([sys.executable, str(hydrus_script)])
|
# Clear out project-venv related env vars to prevent auto-reexec
|
||||||
|
env = os.environ.copy()
|
||||||
|
env.pop("VIRTUAL_ENV", None)
|
||||||
|
env.pop("PYTHONHOME", None)
|
||||||
|
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)
|
||||||
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user