From de562a58b685a7d56874580acb14037f279682f3 Mon Sep 17 00:00:00 2001 From: artie Date: Thu, 18 Sep 2025 15:54:51 +0200 Subject: [PATCH] fixes --- itame.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/itame.py b/itame.py index ce7f9bd..0dc223e 100644 --- a/itame.py +++ b/itame.py @@ -4,20 +4,26 @@ import subprocess import sys +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + + try: subprocess.run( ["bun", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL ) except FileNotFoundError: - print("bun not found, please run the following command to install it:") - print('powershell -c "irm bun.sh/install.ps1|iex"') + eprint("bun not found, please run the following command to install it:") + eprint('powershell -c "irm bun.sh/install.ps1|iex"') sys.exit(1) file_dir = Path(__file__).parent itame_vendor_dir = file_dir / "itame" if not itame_vendor_dir.exists(): - print("script must be placed in the parent directory of the vendor itame directory") + eprint( + "script must be placed in the parent directory of the vendor itame directory" + ) sys.exit(1) node_modules_dir = itame_vendor_dir / "node_modules" @@ -27,11 +33,15 @@ if not node_modules_dir.exists(): old_dir = os.getcwd() os.chdir(itame_vendor_dir) - p = subprocess.run(["bun", "i"]) + eprint("installing dependencies") + p = subprocess.run(["bun", "i"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) if p.returncode != 0: - print("failed to install node modules") + eprint("failed to install dependencies") + eprint(p.stderr.decode("utf-8")) + eprint(p.stdout.decode("utf-8")) sys.exit(1) os.chdir(old_dir) + eprint() subprocess.run(["bun", "run", str(entrypoint)] + sys.argv[1:])