File tree 1 file changed +20
-3
lines changed
1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,16 @@ function cleanup() {
38
38
function cleanupCache ( ) {
39
39
const cacheLocation = getUserCachePath ( this . options ) ;
40
40
if ( fse . existsSync ( cacheLocation ) ) {
41
+ let cleanupProgress ;
41
42
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
+ }
43
51
}
44
52
45
53
// Only remove cache folders that we added, just incase someone accidentally puts a weird
@@ -50,10 +58,19 @@ function cleanupCache() {
50
58
. forEach ( ( file ) => {
51
59
promises . push ( fse . removeAsync ( file ) ) ;
52
60
} ) ;
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
+ } ) ;
54
67
} else {
55
68
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
+ }
57
74
}
58
75
return BbPromise . resolve ( ) ;
59
76
}
You can’t perform that action at this time.
0 commit comments