From 903125b8a5df74aac1b3f1d00991a41493a375ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Mar 2026 16:02:11 +0000 Subject: [PATCH] fix: replace deprecated async fs.exists with fs.existsSync in addRootPath The previous code used fs.exists() (deprecated async callback) to check whether the resolved executable path exists before applying it. Because the callback ran asynchronously, loadSettings() returned before the path was updated. On the first save after a VS Code restart, getArgs() was called with the still-relative executablePath, causing spawn to fail. Fix: use fs.existsSync() so the path check and update are synchronous and complete before loadSettings() returns. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- extension.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/extension.js b/extension.js index 81a61ce..28986b2 100644 --- a/extension.js +++ b/extension.js @@ -267,11 +267,9 @@ class PHPCBF { prefix, rootPath ); - fs.exists(tmpExecutablePath, exists => { - if (exists) { - this.executablePath = tmpExecutablePath; - } - }); + if (fs.existsSync(tmpExecutablePath)) { + this.executablePath = tmpExecutablePath; + } } } }