diff options
| author | Bozhidar Batsov <bozhidar@batsov.dev> | 2026-02-28 10:43:37 +0200 |
|---|---|---|
| committer | Bozhidar Batsov <bozhidar@batsov.dev> | 2026-02-28 10:51:37 +0200 |
| commit | 2cd6d01c8dccf6ce339f4ccd3372acec22bc2cd9 (patch) | |
| tree | 4140bfb1f3c00894ff5312751d59b3e36b6534c6 /projectile.el | |
| parent | 7419a9ee5013f559886c52e1773d70aa0423ffed (diff) | |
Add 30s timeout to projectile-check-vcs-status busy-wait
The unbounded (while (vc-dir-busy) ...) loop could freeze Emacs
indefinitely if vc-dir hangs (e.g., broken remote repo). This is
especially dangerous when called for every known project via
projectile-check-vcs-status-of-known-projects.
Diffstat (limited to 'projectile.el')
| -rw-r--r-- | projectile.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/projectile.el b/projectile.el index 3a83b97..6ddd367 100644 --- a/projectile.el +++ b/projectile.el @@ -6138,8 +6138,10 @@ If PROJECT-PATH is a project, check this one instead." (project-status nil)) (save-excursion (vc-dir project-path) - ;; wait until vc-dir is done - (while (vc-dir-busy) (sleep-for 0.1)) + ;; wait until vc-dir is done (with a 30s timeout to avoid freezing) + (let ((deadline (time-add (current-time) 30))) + (while (and (vc-dir-busy) (time-less-p (current-time) deadline)) + (sleep-for 0.1))) ;; check for status (save-excursion (save-match-data |
