From 6b1e0024d172ebd2300a0646813c1b9355bc3644 Mon Sep 17 00:00:00 2001 From: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Date: Sun, 19 Oct 2025 20:45:50 +0800 Subject: [PATCH] correct shell handling --- scripts/deploy.py | 14 +++++++++----- scripts/format.py | 10 +++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/scripts/deploy.py b/scripts/deploy.py index c318ad5..f240d48 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -6,6 +6,7 @@ This script: 2. Runs docker compose up -d --build """ +import platform import subprocess import sys from pathlib import Path @@ -22,7 +23,10 @@ def run_command(cmd: list[str], cwd: Path | None = None, description: str = ""): if cwd: print(f" in: {cwd}") - result = subprocess.run(cmd, cwd=cwd, shell=True) + # Use shell=True on Windows (npm is npm.cmd), False on Unix + use_shell = platform.system() == "Windows" + + result = subprocess.run(cmd, cwd=cwd, shell=use_shell) if result.returncode != 0: print(f"\nāŒ Command failed with exit code {result.returncode}") @@ -37,7 +41,7 @@ def main(): ui_dir = root_dir / "src" / "kohaku-hub-ui" admin_dir = root_dir / "src" / "kohaku-hub-admin" - print("\nšŸš€ KohakuHub Deployment") + print("\nKohakuHub Deployment") print("=" * 60) # Step 1: Build UI @@ -54,14 +58,14 @@ def main(): ) print("\n" + "=" * 60) - print("āœ… KohakuHub deployed successfully!") + print("[OK] KohakuHub deployed successfully!") print("=" * 60) - print("\nšŸ“ Access Points:") + print("\nAccess Points:") print(" Main UI: http://localhost:28080") print(" Admin UI: http://localhost:28080/admin") print(" API: http://localhost:28080/api") print(" API Docs: http://localhost:28080/docs") - print("\nšŸ’” Tip: View logs with: docker compose logs -f") + print("\nTip: View logs with: docker compose logs -f") if __name__ == "__main__": diff --git a/scripts/format.py b/scripts/format.py index b5616c3..5c3b637 100644 --- a/scripts/format.py +++ b/scripts/format.py @@ -7,6 +7,7 @@ This script: 3. Formats backend Python code """ +import platform import subprocess import sys from pathlib import Path @@ -23,7 +24,10 @@ def run_command(cmd: list[str], cwd: Path | None = None, description: str = ""): if cwd: print(f" in: {cwd}") - result = subprocess.run(cmd, cwd=cwd, shell=True) + # Use shell=True on Windows (npm is npm.cmd), False on Unix + use_shell = platform.system() == "Windows" + + result = subprocess.run(cmd, cwd=cwd, shell=use_shell) if result.returncode != 0: print(f"\nāŒ Command failed with exit code {result.returncode}") @@ -38,7 +42,7 @@ def main(): ui_dir = root_dir / "src" / "kohaku-hub-ui" admin_dir = root_dir / "src" / "kohaku-hub-admin" - print("\nšŸŽØ KohakuHub Code Formatter") + print("\nKohakuHub Code Formatter") print("=" * 60) # Step 1: Build UI (generates router/component definitions) @@ -67,7 +71,7 @@ def main(): run_command(["black", "."], cwd=root_dir, description="Formatting Python code") print("\n" + "=" * 60) - print("āœ… All code formatted successfully!") + print("[OK] All code formatted successfully!") print("=" * 60)