Skip to content

Commit e4579ee

Browse files
takemi-ohamaclaude
andcommitted
fix(plugin): git_clone でシェル CWD 削除時の失敗を回避
シェルのカレントディレクトリが削除された状態で `devbase plugin update` を 実行すると、Python から `git clone` を呼ぶ際に無効な CWD を継承し、 git-remote-https ヘルパが起動時に getcwd() ENOENT で落ちていた: fatal: Unable to read current working directory: No such file or directory fatal: remote helper 'https' aborted session `git_clone()` で subprocess.run() に `cwd=dest.parent` を明示し、 親プロセスの CWD に依存しないようにする。`dest.parent.mkdir(parents=True, exist_ok=True)` で cwd 用ディレクトリの存在も保証する。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4d16449 commit e4579ee

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/devbase/plugin/installer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ def git_clone(url: str, dest: Path, ref: Optional[str] = None) -> None:
5555
if ref:
5656
cmd.extend(['--branch', ref])
5757
cmd.extend([url, str(dest)])
58+
dest.parent.mkdir(parents=True, exist_ok=True)
5859
try:
59-
subprocess.run(cmd, check=True, capture_output=True, text=True)
60+
subprocess.run(
61+
cmd, check=True, capture_output=True, text=True, cwd=str(dest.parent),
62+
)
6063
except subprocess.CalledProcessError as e:
6164
raise PluginError(f"git clone failed for {url}: {e.stderr.strip()}")
6265

0 commit comments

Comments
 (0)