@@ -189,6 +189,7 @@ module.exports = function run(args) {
189189 await utils . stopLocalBinary ( bsConfig , bs_local , args ) ;
190190
191191 utils . sendUsageReport ( bsConfig , args , err , Constants . messageTypes . ERROR , 'build_failed' ) ;
192+ process . exitCode = Constants . ERROR_EXIT_CODE ;
192193 } ) ;
193194 } ) . catch ( function ( err ) {
194195 // Zip Upload failed | Local Start failed
@@ -200,6 +201,7 @@ module.exports = function run(args) {
200201 fileHelpers . deleteZip ( ) ;
201202 utils . sendUsageReport ( bsConfig , args , `${ err } \n${ Constants . userMessages . ZIP_UPLOAD_FAILED } ` , Constants . messageTypes . ERROR , 'zip_upload_failed' ) ;
202203 }
204+ process . exitCode = Constants . ERROR_EXIT_CODE ;
203205 } ) ;
204206 } ) . catch ( function ( err ) {
205207 // Zipping failed
@@ -211,12 +213,14 @@ module.exports = function run(args) {
211213 } catch ( err ) {
212214 utils . sendUsageReport ( bsConfig , args , Constants . userMessages . ZIP_DELETE_FAILED , Constants . messageTypes . ERROR , 'zip_deletion_failed' ) ;
213215 }
216+ process . exitCode = Constants . ERROR_EXIT_CODE ;
214217 } ) ;
215218 } ) . catch ( function ( err ) {
216219 // md5 check failed
217220 logger . error ( err ) ;
218221 logger . error ( Constants . userMessages . FAILED_MD5_CHECK ) ;
219222 utils . sendUsageReport ( bsConfig , args , Constants . userMessages . MD5_CHECK_FAILED , Constants . messageTypes . ERROR , 'zip_already_uploaded_failed' ) ;
223+ process . exitCode = Constants . ERROR_EXIT_CODE ;
220224 } ) ;
221225 } ) . catch ( function ( err ) {
222226 // browerstack.json is not valid
@@ -230,10 +234,12 @@ module.exports = function run(args) {
230234
231235 let error_code = utils . getErrorCodeFromMsg ( err ) ;
232236 utils . sendUsageReport ( bsConfig , args , `${ err } \n${ Constants . validationMessages . NOT_VALID } ` , Constants . messageTypes . ERROR , error_code ) ;
237+ process . exitCode = Constants . ERROR_EXIT_CODE ;
233238 } ) ;
234239 } ) . catch ( function ( err ) {
235240 logger . error ( err ) ;
236241 utils . setUsageReportingFlag ( null , args . disableUsageReporting ) ;
237242 utils . sendUsageReport ( null , args , err . message , Constants . messageTypes . ERROR , utils . getErrorCodeFromErr ( err ) ) ;
243+ process . exitCode = Constants . ERROR_EXIT_CODE ;
238244 } ) ;
239245}
0 commit comments