mirror of
https://github.com/microsoft/setup-msbuild.git
synced 2024-11-10 05:51:07 +07:00
Use sync callback
This commit is contained in:
parent
f6890ff843
commit
5cf04033c1
23
dist/index.js
vendored
23
dist/index.js
vendored
@ -1950,17 +1950,22 @@ function run() {
|
|||||||
let foundToolPath = '';
|
let foundToolPath = '';
|
||||||
const options = {};
|
const options = {};
|
||||||
options.listeners = {
|
options.listeners = {
|
||||||
stdout: (data) => __awaiter(this, void 0, void 0, function* () {
|
stdout: (data) => {
|
||||||
var _b;
|
const output = data.toString().trim();
|
||||||
// eslint-disable-next-line prefer-const
|
core.debug(`Found installation path: ${output}`);
|
||||||
let output = data.toString();
|
const pattern = `${output}\\\\MSBuild\\**\\Bin\\msbuild.exe`;
|
||||||
const pattern = `${output.trim()}\\\\MSBuild\\**\\Bin\\msbuild.exe`;
|
/* eslint-disable @typescript-eslint/promise-function-async */
|
||||||
const globber = yield glob.create(pattern);
|
glob
|
||||||
const files = yield globber.glob();
|
.create(pattern)
|
||||||
if (((_b = files) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
.then(globber => globber.glob())
|
||||||
|
.then(files => {
|
||||||
|
var _a;
|
||||||
|
if (((_a = files) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
||||||
foundToolPath = files[0];
|
foundToolPath = files[0];
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
/* eslint-enable @typescript-eslint/promise-function-async */
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// execute the find putting the result of the command in the options foundToolPath
|
// execute the find putting the result of the command in the options foundToolPath
|
||||||
yield exec.exec(`"${vswhereToolExe}" ${VSWHERE_EXEC}`, [], options);
|
yield exec.exec(`"${vswhereToolExe}" ${VSWHERE_EXEC}`, [], options);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"lint": "eslint src/**/*.ts",
|
"lint": "eslint src/**/*.ts",
|
||||||
"pack": "ncc build",
|
"pack": "ncc build",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"all": "npm run build && npm run format && npm run lint && npm run pack && npm test"
|
"all": "npm run build && npm run format && npm run lint && npm run pack"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
17
src/main.ts
17
src/main.ts
@ -59,17 +59,22 @@ async function run(): Promise<void> {
|
|||||||
let foundToolPath = ''
|
let foundToolPath = ''
|
||||||
const options: ExecOptions = {}
|
const options: ExecOptions = {}
|
||||||
options.listeners = {
|
options.listeners = {
|
||||||
stdout: async (data: Buffer) => {
|
stdout: (data: Buffer) => {
|
||||||
// eslint-disable-next-line prefer-const
|
const output = data.toString().trim()
|
||||||
let output = data.toString()
|
core.debug(`Found installation path: ${output}`)
|
||||||
|
|
||||||
const pattern = `${output.trim()}\\\\MSBuild\\**\\Bin\\msbuild.exe`
|
const pattern = `${output}\\\\MSBuild\\**\\Bin\\msbuild.exe`
|
||||||
const globber = await glob.create(pattern)
|
|
||||||
const files = await globber.glob()
|
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/promise-function-async */
|
||||||
|
glob
|
||||||
|
.create(pattern)
|
||||||
|
.then(globber => globber.glob())
|
||||||
|
.then(files => {
|
||||||
if (files?.length > 0) {
|
if (files?.length > 0) {
|
||||||
foundToolPath = files[0]
|
foundToolPath = files[0]
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
/* eslint-enable @typescript-eslint/promise-function-async */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user