Skip to content

Commit 051a071

Browse files
committed
gen bundle once file created
1 parent 1f23682 commit 051a071

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cli/support.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ func (r *RootCmd) support() *clibase.Cmd {
6363

6464
deps.AgentID = agt.ID
6565

66-
bun, err := support.Run(inv.Context(), &deps)
67-
if err != nil {
68-
return err
69-
}
70-
7166
if outputPath == "" {
7267
cwd, err := filepath.Abs(".")
7368
if err != nil {
@@ -83,6 +78,13 @@ func (r *RootCmd) support() *clibase.Cmd {
8378
}
8479
zwr := zip.NewWriter(w)
8580
defer zwr.Close()
81+
82+
bun, err := support.Run(inv.Context(), &deps)
83+
if err != nil {
84+
_ = os.Remove(outputPath) // best effort
85+
return xerrors.Errorf("create support bundle: %w", err)
86+
}
87+
8688
if err := writeBundle(bun, zwr); err != nil {
8789
return xerrors.Errorf("write support bundle to %s: %w", outputPath, err)
8890
}

0 commit comments

Comments
 (0)