File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
- import * as fsPromises from 'fs/promises' ;
2
1
import * as fs from 'fs' ;
3
2
import * as path from 'path' ;
4
3
import * as tar from 'tar' ;
5
4
import axios from 'axios' ;
6
5
import * as unzipper from 'unzipper' ;
7
6
import { logger } from "../wrapper/loggerConfig" ;
8
7
import { finished } from 'stream/promises' ;
8
+ import { promisify } from "node:util" ;
9
9
10
10
type SupportedPlatforms = 'win32' | 'darwin' | 'linux' ;
11
+ const readFileAsync = promisify ( fs . readFile ) ;
11
12
12
13
export class CxInstaller {
13
14
private readonly platform : string ;
@@ -106,15 +107,15 @@ export class CxInstaller {
106
107
private checkExecutableExists ( ) : boolean {
107
108
return fs . existsSync ( this . getExecutablePath ( ) ) ;
108
109
}
109
-
110
+
110
111
private async readASTCLIVersion ( ) : Promise < string > {
111
112
if ( this . cliVersion ) {
112
113
return this . cliVersion ;
113
114
}
114
115
try {
115
116
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 ( ) ;
118
119
} catch ( error ) {
119
120
logger . warn ( 'Error reading AST CLI version: ' + error . message ) ;
120
121
return this . cliDefaultVersion ;
You can’t perform that action at this time.
0 commit comments