This repository was archived by the owner on Oct 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,16 @@ function cleanup() {
3838function cleanupCache ( ) {
3939 const cacheLocation = getUserCachePath ( this . options ) ;
4040 if ( fse . existsSync ( cacheLocation ) ) {
41+ let cleanupProgress ;
4142 if ( this . serverless ) {
42- this . serverless . cli . log ( `Removing static caches at: ${ cacheLocation } ` ) ;
43+ if ( this . progress ) {
44+ cleanupProgress = this . progress . get ( 'python-cleanup-cache' ) ;
45+ cleanupProgress . notice ( `Removing static caches at: ${ cacheLocation } ` , {
46+ isMainEvent : true ,
47+ } ) ;
48+ } else {
49+ this . serverless . cli . log ( `Removing static caches at: ${ cacheLocation } ` ) ;
50+ }
4351 }
4452
4553 // Only remove cache folders that we added, just incase someone accidentally puts a weird
@@ -50,10 +58,19 @@ function cleanupCache() {
5058 . forEach ( ( file ) => {
5159 promises . push ( fse . removeAsync ( file ) ) ;
5260 } ) ;
53- return BbPromise . all ( promises ) ;
61+ return BbPromise . all ( promises )
62+ . then ( ( ) => cleanupProgress && cleanupProgress . remove ( ) )
63+ . catch ( ( e ) => {
64+ cleanupProgress && cleanupProgress . remove ( ) ;
65+ throw e ;
66+ } ) ;
5467 } else {
5568 if ( this . serverless ) {
56- this . serverless . cli . log ( `No static cache found` ) ;
69+ if ( this . log ) {
70+ this . log . info ( `No static cache found` ) ;
71+ } else {
72+ this . serverless . cli . log ( `No static cache found` ) ;
73+ }
5774 }
5875 return BbPromise . resolve ( ) ;
5976 }
You can’t perform that action at this time.
0 commit comments