From 48f5048df86072b946c106615955d0f4ca1949fa Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 5 Aug 2026 18:01:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20shell=5Fexec=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6=E5=9B=9E=E8=90=BD=E5=8F=AF?= =?UTF-8?q?=E5=86=99=E5=9F=BA=E7=A1=80=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_service/init.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pipeline_service/init.py b/pipeline_service/init.py index 62f25a7..cc897ab 100644 --- a/pipeline_service/init.py +++ b/pipeline_service/init.py @@ -393,6 +393,10 @@ async def shell_exec(command: str, workdir: str = None, timeout: int = 60): """ cwd = workdir or _resolve_workdir() cwd = os.path.abspath(cwd) + # 如果指定目录不存在,回落到可写基础目录 + if not os.path.isdir(cwd): + cwd = _resolve_workdir() + cwd = os.path.abspath(cwd) base = os.path.abspath(_SHELL_BASE_DIR) fallback = os.path.abspath(_WORKDIR_FALLBACK) if not (cwd.startswith(base) or cwd.startswith(fallback)):