@@ -135,8 +135,6 @@ func (c *CLI) BuildWithReport() *CLI {
135135
136136 if c .reportPath != "" {
137137 c .cmd .Args = append (c .cmd .Args , "--report" , c .reportPath )
138- c .vexPath = filepath .Join (os .TempDir (), defaultVexFile )
139- c .cmd .Args = append (c .cmd .Args , "--output" , c .vexPath )
140138 }
141139
142140 return c
@@ -157,6 +155,18 @@ func (c *CLI) setupAuth() error {
157155 return nil
158156}
159157
158+ func (c * CLI ) setupVexDir () error {
159+ if c .reportPath != "" {
160+ path , err := os .MkdirTemp (os .TempDir (), "vex-*" )
161+ if err != nil {
162+ return err
163+ }
164+ c .vexPath = filepath .Join (path , defaultVexFile )
165+ c .cmd .Args = append (c .cmd .Args , "--output" , c .vexPath )
166+ }
167+ return nil
168+ }
169+
160170func (c * CLI ) validateCommand () error {
161171 if c .cmd == nil {
162172 return fmt .Errorf ("no command built - call a Build method first" )
@@ -235,6 +245,10 @@ func (c *CLI) Run(ctx context.Context) (*ExecutionResult, error) {
235245 return nil , fmt .Errorf ("authentication setup failed: %w" , err )
236246 }
237247
248+ if err := c .setupVexDir (); err != nil {
249+ return nil , fmt .Errorf ("creating vex temp dir failed: %w" , err )
250+ }
251+
238252 result , err := c .execute (ctx )
239253 if err != nil {
240254 return result , fmt .Errorf ("execution failed: %w" , err )
0 commit comments