From ff53da4e4dc7be3c05163cf7fd33bf139ccdfcca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20Carri=C3=A8re?= Date: Tue, 3 Apr 2018 10:25:27 -0400 Subject: [PATCH] Pass in working directory to the process executing the phpcbf command so reports can be generated properly and replacing the console.group() and console.groupEnd() with console.log() because those don't exists in node and trigger errors. --- extension.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/extension.js b/extension.js index e50ffbe..01eb883 100644 --- a/extension.js +++ b/extension.js @@ -70,7 +70,7 @@ class PHPCBF { args.push("--standard=" + this.standard); } if (this.debug) { - console.group("PHPCBF"); + console.log("----- PHPCBF -----"); console.log( "PHPCBF args: " + this.executablePath + " " + args.join(" ") ); @@ -93,7 +93,11 @@ class PHPCBF { ".php"; fs.writeFileSync(fileName, text); - let exec = cp.spawn(this.executablePath, this.getArgs(fileName)); + let cmdOptions = { + cwd: TmpDir + }; + + let exec = cp.spawn(this.executablePath, this.getArgs(fileName), cmdOptions); if (!this.debug) { exec.stdin.end(); } @@ -164,7 +168,7 @@ class PHPCBF { // console.log(code); if (this.debug) { console.timeEnd("phpcbf"); - console.groupEnd(); + console.log("----- END PHPCBF -----"); } });