File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,10 @@ pub struct CleanWorkflow
1414
1515impl CleanWorkflow
1616{
17- pub fn wizard ( _ctx : & mut RunnerContext ) -> Result < ( ) , BeansError >
17+ pub fn wizard ( ctx : & mut RunnerContext ) -> Result < ( ) , BeansError >
1818 {
1919 let target_directory = helper:: get_tmp_dir ( ) ;
20+ let staging_dir_location = ctx. get_staging_location ( ) ;
2021
2122 info ! ( "[CleanWorkflow] Cleaning up {}" , target_directory) ;
2223 if !helper:: file_exists ( target_directory. clone ( ) )
@@ -46,6 +47,24 @@ impl CleanWorkflow
4647 } ) ;
4748 }
4849
50+ // clean up butler files if it was interrupted in previous install
51+ if !helper:: file_exists ( staging_dir_location. clone ( ) )
52+ {
53+ debug ! ( "[CleanWorkflow] Staging directory used by butler not found, nothing to clean." )
54+ } else {
55+ // delete temp butler directory and it's contents (and error handling)
56+ info ! ( "[CleanWorkflow] Cleaning up {}" , staging_dir_location) ;
57+ if let Err ( e) = std:: fs:: remove_dir_all ( & staging_dir_location)
58+ {
59+ debug ! ( "[CleanWorkflow::wizard] remove_dir_all {:#?}" , e) ;
60+ return Err ( BeansError :: CleanTempFailure {
61+ location : staging_dir_location,
62+ error : e,
63+ backtrace : std:: backtrace:: Backtrace :: capture ( )
64+ } ) ;
65+ }
66+ }
67+
4968 info ! ( "[CleanWorkflow] Done!" ) ;
5069 Ok ( ( ) )
5170 }
You can’t perform that action at this time.
0 commit comments