From c7125bbc286e4c5f2aaa15f6a73bfcdc070d5dfc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 16 Mar 2026 18:56:46 +0000 Subject: [PATCH] fix: always close stdin in format() regardless of debug mode When phpcbf.debug is true, exec.stdin was left open, causing the spawned phpcbf process to block waiting for stdin input. This manifests as the onWillSaveTextDocument timeout error (issue #35) when debug mode is enabled. phpcbf operates on a temp file passed as an argument, never on stdin, so stdin should always be closed immediately after spawn. Closes #35 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- extension.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/extension.js b/extension.js index 6457e71..ead818f 100644 --- a/extension.js +++ b/extension.js @@ -149,9 +149,7 @@ class PHPCBF { fs.writeFileSync(fileName, text); let exec = cp.spawn(this.executablePath, this.getArgs(document, fileName)); - if (!this.debug) { - exec.stdin.end(); - } + exec.stdin.end(); let promise = new Promise((resolve, reject) => { exec.on("error", err => {