@@ -30,7 +30,6 @@ export class CxAuth {
3030 }
3131 let executablePath : string ;
3232
33-
3433 if ( cxScanConfig . pathToExecutable !== null && cxScanConfig . pathToExecutable !== "" ) {
3534 this . pathToExecutable = cxScanConfig . pathToExecutable ;
3635 } else if ( process . platform === 'win32' ) {
@@ -39,19 +38,13 @@ export class CxAuth {
3938 } else if ( process . platform === 'darwin' ) {
4039 executablePath = path . join ( __dirname , '/resources/cx-mac' ) ;
4140 this . pathToExecutable = executablePath ;
42- fs . chmod ( this . pathToExecutable , 7 , function ( err ) {
43- console . log ( "Permission function output: " , err )
44- } )
45- }
46- else {
47-
41+ fs . chmodSync ( this . pathToExecutable , 0o777 ) ;
42+ } else {
4843 executablePath = path . join ( __dirname , '/resources/cx-linux' ) ;
4944 this . pathToExecutable = executablePath ;
50- fs . chmod ( this . pathToExecutable , 7 , function ( err ) {
51- console . log ( "Permission function output: " , err )
52- } )
53-
45+ fs . chmodSync ( this . pathToExecutable , 0o777 ) ;
5446 }
47+
5548 if ( cxScanConfig . baseUri !== null && cxScanConfig . baseUri !== '' ) {
5649 this . baseUri = cxScanConfig . baseUri ;
5750 }
@@ -88,13 +81,13 @@ export class CxAuth {
8881 this . commands . push ( "scan" ) ;
8982 this . commands . push ( "create" ) ;
9083 params . forEach ( ( value : string , key : CxParamType ) => {
91- if ( key !== CxParamType . ADDITIONAL_PARAMETERS && key . length !== 1 && value !== null && value !== undefined && value . length > 1 ) {
84+ if ( key !== CxParamType . ADDITIONAL_PARAMETERS && key . length !== 1 && value !== null && value !== undefined && value . length > 1 ) {
9285 this . commands . push ( "--" + key . toString ( ) . replace ( / _ / g, "-" ) . toLowerCase ( ) ) ;
9386 this . commands . push ( value ) ;
94- } else if ( key . length === 1 && value !== null && value !== undefined ) {
87+ } else if ( key . length === 1 && value !== null && value !== undefined ) {
9588 this . commands . push ( "-" + key . toString ( ) . replace ( / _ / g, "-" ) . toLowerCase ( ) ) ;
9689 this . commands . push ( value ) ;
97- } else if ( key === CxParamType . ADDITIONAL_PARAMETERS ) {
90+ } else if ( key === CxParamType . ADDITIONAL_PARAMETERS ) {
9891 let paramList = value . match ( / (?: [ ^ \s " ] + | " [ ^ " ] * " ) + / g) ;
9992 console . log ( "Additional parameters refined: " + paramList )
10093 if ( paramList !== null ) {
@@ -139,42 +132,40 @@ export class CxAuth {
139132 this . commands = this . initializeCommands ( false ) ;
140133 this . commands . push ( "result" ) ;
141134 this . commands . push ( "list" ) ;
142- if ( scanId !== null && scanId !== "" ) {
135+ if ( scanId !== null && scanId !== "" ) {
143136 this . commands . push ( "--scan-id" )
144137 this . commands . push ( scanId )
145- }
146- else {
138+ } else {
147139 console . log ( "Scan Id not provided" )
148140 }
149- if ( formatType !== null && formatType != '' ) {
141+ if ( formatType !== null && formatType != '' ) {
150142 this . commands . push ( "--format" )
151143 this . commands . push ( formatType )
152144 }
153145 let exec = new ExecutionService ( ) ;
154- return await exec . executeResultsCommands ( this . pathToExecutable , this . commands )
155- }
146+ return await exec . executeResultsCommands ( this . pathToExecutable , this . commands )
147+ }
156148
157- async getResultsSummary ( scanId : string , formatType : string , target :string ) {
149+ async getResultsSummary ( scanId : string , formatType : string , target : string ) {
158150 this . commands = this . initializeCommands ( false ) ;
159151 this . commands . push ( "result" ) ;
160152 this . commands . push ( "summary" ) ;
161- if ( scanId !== null && scanId !== "" ) {
153+ if ( scanId !== null && scanId !== "" ) {
162154 this . commands . push ( "--scan-id" )
163155 this . commands . push ( scanId )
164- }
165- else {
156+ } else {
166157 console . log ( "Scan Id not provided" )
167158 }
168- if ( formatType !== null && formatType != '' ) {
159+ if ( formatType !== null && formatType != '' ) {
169160 this . commands . push ( "--format" )
170161 this . commands . push ( formatType )
171162 }
172- if ( target !== null && target != '' ) {
163+ if ( target !== null && target != '' ) {
173164 this . commands . push ( "--target" )
174165 this . commands . push ( target )
175166 }
176167 let exec = new ExecutionService ( ) ;
177- return await exec . executeResultsCommands ( this . pathToExecutable , this . commands )
168+ return await exec . executeResultsCommands ( this . pathToExecutable , this . commands )
178169 }
179170
180171 async getResults ( scanId : string , targetPath : string , resultParam : CxResultType ) {
0 commit comments