Skip to content

Commit 9765c68

Browse files
committed
fix: improve handling of php executable
1 parent ba3c42d commit 9765c68

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"devDependencies": {
5454
"@commitlint/cli": "7.2.1",
5555
"@commitlint/config-conventional": "7.1.2",
56+
"@types/execa": "0.9.0",
5657
"@types/mocha": "5.2.5",
5758
"@types/mz": "0.0.32",
5859
"@types/node": "8.10.29",
@@ -65,6 +66,7 @@
6566
"vscode": "1.1.21"
6667
},
6768
"dependencies": {
69+
"execa": "1.0.0",
6870
"mz": "2.7.0",
6971
"semver": "5.5.1",
7072
"vscode-languageclient": "5.0.1"

src/extension.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11

22
import * as path from 'path';
3-
import { spawn, execFile, ChildProcess } from 'mz/child_process';
3+
import { spawn, ChildProcess } from 'mz/child_process';
44
import * as vscode from 'vscode';
55
import { LanguageClient, LanguageClientOptions, StreamInfo } from 'vscode-languageclient';
66
import * as semver from 'semver';
77
import * as net from 'net';
88
import * as url from 'url';
9+
import execa from 'execa';
910

1011
export async function activate(context: vscode.ExtensionContext): Promise<void> {
1112

1213
const conf = vscode.workspace.getConfiguration('php');
13-
const executablePath = conf.get<string>('executablePath') || 'php';
14+
const executablePath = conf.get<string>('executablePath') ||
15+
conf.get<string>('validate.executablePath') ||
16+
(process.platform === 'win32' ? 'php.exe' : 'php');
1417

1518
const memoryLimit = conf.get<string>('memoryLimit') || '4095M';
1619

@@ -28,7 +31,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
2831
// Check path (if PHP is available and version is ^7.0.0)
2932
let stdout: string;
3033
try {
31-
[stdout] = await execFile(executablePath, ['--version']);
34+
stdout = await execa.stdout(executablePath, ['--version']);
3235
} catch (err) {
3336
if (err.code === 'ENOENT') {
3437
const selected = await vscode.window.showErrorMessage(

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"module": "commonjs",
55
"moduleResolution": "node",
66
"outDir": "out",
7+
"esModuleInterop": true,
78
"lib": [
89
"es6"
910
],

0 commit comments

Comments
 (0)