From f13b998bbc4a7729fda580928505615dc80853b2 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Thu, 26 Mar 2026 14:13:48 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20AppleScript=20=ED=96=89=EB=B3=84=20-e=20?= =?UTF-8?q?=EB=B6=84=ED=95=A0=20=EC=8B=A4=ED=96=89=20=E2=80=94=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EB=B0=A9=EC=8B=9D=20=EC=9D=B8=EC=BD=94=EB=94=A9=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=9A=8C=ED=94=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/pkm_utils.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/pkm_utils.py b/scripts/pkm_utils.py index b220921..ed659d2 100644 --- a/scripts/pkm_utils.py +++ b/scripts/pkm_utils.py @@ -94,20 +94,18 @@ def run_applescript(script_path: str, *args) -> str: def run_applescript_inline(script: str) -> str: - """인라인 AppleScript 실행 — 임시 파일 방식 (특수문자 안전)""" - import tempfile - tmp = tempfile.NamedTemporaryFile(mode='w', suffix='.applescript', delete=False, encoding='utf-8') + """인라인 AppleScript 실행 — 행별 -e 분할 방식""" + lines = script.strip().split('\n') + cmd = ["osascript"] + for line in lines: + cmd.extend(["-e", line]) try: - tmp.write(script) - tmp.close() - result = subprocess.run(["osascript", tmp.name], capture_output=True, text=True, timeout=120) + result = subprocess.run(cmd, capture_output=True, text=True, timeout=120) if result.returncode != 0: raise RuntimeError(f"AppleScript 에러: {result.stderr.strip()}") return result.stdout.strip() except subprocess.TimeoutExpired: raise RuntimeError("AppleScript 타임아웃 (인라인)") - finally: - os.unlink(tmp.name) def llm_generate(prompt: str, model: str = "mlx-community/Qwen3.5-35B-A3B-4bit",