Skip to content

Commit f24bbdb

Browse files
committed
check
1 parent 8b58602 commit f24bbdb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/osinstaller/CxInstaller.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import * as fsPromises from 'fs/promises';
21
import * as fs from 'fs';
32
import * as path from 'path';
43
import * as tar from 'tar';
54
import axios from 'axios';
65
import * as unzipper from 'unzipper';
76
import {logger} from "../wrapper/loggerConfig";
87
import {finished} from 'stream/promises';
8+
import {promisify} from "node:util";
99

1010
type SupportedPlatforms = 'win32' | 'darwin' | 'linux';
11+
const readFileAsync = promisify(fs.readFile);
1112

1213
export class CxInstaller {
1314
private readonly platform: string;
@@ -106,15 +107,15 @@ export class CxInstaller {
106107
private checkExecutableExists(): boolean {
107108
return fs.existsSync(this.getExecutablePath());
108109
}
109-
110+
110111
private async readASTCLIVersion(): Promise<string> {
111112
if (this.cliVersion) {
112113
return this.cliVersion;
113114
}
114115
try {
115116
const versionFilePath = path.join('checkmarx-ast-cli.version');
116-
const versionContent = await fsPromises.readFile(versionFilePath, 'utf-8');
117-
return versionContent.trim();
117+
const versionContent = await readFileAsync(versionFilePath);
118+
return versionContent.toString().trim();
118119
} catch (error) {
119120
logger.warn('Error reading AST CLI version: ' + error.message);
120121
return this.cliDefaultVersion;

0 commit comments

Comments
 (0)