Skip to content

Commit 3c23560

Browse files
FutureHiraishino
andauthored
fix(subcmds/saas): remove timestamped directory in results-dir (#2248)
Co-authored-by: Shunichi Shinohara <[email protected]>
1 parent 902a7ab commit 3c23560

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

subcmds/saas.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ func (p *SaaSCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
8282
return subcommands.ExitFailure
8383
}
8484

85+
defer func() {
86+
if config.Conf.Debug {
87+
return
88+
}
89+
if err := os.RemoveAll(dir); err != nil {
90+
logging.Log.Warnf("Failed to remove %q. err: %+v", dir, err)
91+
}
92+
}()
93+
8594
logging.Log.Info("Validating config...")
8695
if !config.Conf.ValidateOnSaaS() {
8796
return subcommands.ExitUsageError
@@ -134,11 +143,5 @@ func (p *SaaSCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
134143
return subcommands.ExitFailure
135144
}
136145

137-
if !config.Conf.Debug {
138-
if err := os.RemoveAll(dir); err != nil {
139-
logging.Log.Warnf("Failed to remove %s. err: %+v", dir, err)
140-
}
141-
}
142-
143146
return subcommands.ExitSuccess
144147
}

0 commit comments

Comments
 (0)