diff --git a/src/phpcs-report/__tests__/worker-integration.test.ts b/src/phpcs-report/__tests__/worker-integration.test.ts index 313e31b..a4a8585 100644 --- a/src/phpcs-report/__tests__/worker-integration.test.ts +++ b/src/phpcs-report/__tests__/worker-integration.test.ts @@ -31,7 +31,9 @@ describe('Worker/WorkerPool Integration', () => { ); try { - child_process.execFileSync(phpcsPath, ['--version']); + child_process.execFileSync(phpcsPath, ['--version'], { + shell: true, + }); } catch (e) { throw new Error( 'PHPCS could not be found at "' + diff --git a/src/phpcs-report/__tests__/worker.spec.ts b/src/phpcs-report/__tests__/worker.spec.ts index 65f1bd5..3755363 100644 --- a/src/phpcs-report/__tests__/worker.spec.ts +++ b/src/phpcs-report/__tests__/worker.spec.ts @@ -31,7 +31,9 @@ describe('Worker', () => { ); try { - child_process.execFileSync(phpcsPath, ['--version']); + child_process.execFileSync(phpcsPath, ['--version'], { + shell: true, + }); } catch (e) { console.log(e); throw new Error( diff --git a/src/phpcs-report/worker.ts b/src/phpcs-report/worker.ts index 8ee9c97..25bc54e 100644 --- a/src/phpcs-report/worker.ts +++ b/src/phpcs-report/worker.ts @@ -274,6 +274,8 @@ export class Worker { }), }, windowsHide: true, + // Node requires that the shell option be used on Windows to execute batch scripts. + shell: process.platform === 'win32' ? true : false, }; // Make sure PHPCS knows to read from STDIN.