Skip to content

Commit

Permalink
maybe fix: #217
Browse files Browse the repository at this point in the history
  • Loading branch information
junstyle committed Aug 13, 2024
1 parent 93a7c60 commit fab8d0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "php-cs-fixer",
"displayName": "php cs fixer",
"description": "PHP CS Fixer extension for VS Code, php formatter, php code beautify tool, format html",
"version": "0.3.14",
"version": "0.3.15",
"publisher": "junstyle",
"author": "junstyle",
"license": "ISC",
Expand Down
8 changes: 6 additions & 2 deletions src/runAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ import { spawn, SpawnOptionsWithoutStdio } from 'child_process';
import { output } from './output';

export function runAsync(command: string, args: string[], options: SpawnOptionsWithoutStdio, onData: (data: Buffer) => void = null) {
const cpOptions = Object.assign({}, options, { shell: true, })
const cpOptions = Object.assign({}, options, { shell: process.platform == 'win32', })
let cp;
try {
output('runAsync: spawn ' + command);
output(JSON.stringify(args, null, 2))
output(JSON.stringify(cpOptions, null, 2))

if (process.platform == 'win32' && command.includes(" ") && command[0] != '"') {
command = '"' + command + '"'
}

cp = spawn(command, args, cpOptions)
} catch (err) {
const promise = new Promise((resolve, reject) => {
Expand All @@ -17,7 +21,7 @@ export function runAsync(command: string, args: string[], options: SpawnOptionsW
output('runAsync: reject promise')
reject(err)
})
; (promise as any).cp = cp
; (promise as any).cp = cp

return promise
}
Expand Down

0 comments on commit fab8d0a

Please sign in to comment.