Skip to content

Commit 210bbcd

Browse files
committed
Avoid using a synchronous file system command
Add the tmp-promise package to allow for async tmp file operations.
1 parent 4618927 commit 210bbcd

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 31 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@
612612
"vscode-test-adapter-util": "~0.7.0",
613613
"minimist": "~1.2.5",
614614
"semver": "~7.3.2",
615-
"@types/semver": "~7.2.0"
615+
"@types/semver": "~7.2.0",
616+
"tmp-promise": "~3.0.2"
616617
},
617618
"devDependencies": {
618619
"@types/chai": "^4.1.7",

extensions/ql-vscode/src/definitions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from 'fs-extra';
22
import * as yaml from 'js-yaml';
3-
import * as tmp from 'tmp';
3+
import * as tmp from 'tmp-promise';
44
import * as vscode from 'vscode';
55
import { decodeSourceArchiveUri, zipArchiveScheme } from './archive-filesystem-provider';
66
import { ColumnKindCode, EntityValue, getResultSetSchema, LineColumnLocation, UrlValue } from './bqrs-cli-types';
@@ -42,7 +42,7 @@ function nameOfKeyType(keyType: KeyType): string {
4242
}
4343

4444
async function resolveQueries(cli: CodeQLCliServer, qlpack: string, keyType: KeyType): Promise<string[]> {
45-
const suiteFile = tmp.fileSync({ postfix: '.qls' }).name;
45+
const suiteFile = (await tmp.file()).path;
4646
const suiteYaml = { qlpack, include: { kind: 'definitions', 'tags contain': tagOfKeyType(keyType) } };
4747
await fs.writeFile(suiteFile, yaml.safeDump(suiteYaml), 'utf8');
4848

0 commit comments

Comments
 (0)