Skip to content

Commit cc95295

Browse files
vercel-eddieclaude
andcommitted
fix: Run update install script from temp directory
The install script writes intermediate files to the CWD which can fail if the directory is read-only or contains conflicting files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 251d574 commit cc95295

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

pkg/commands/update.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@ func Update() *cli.Command {
3333

3434
p.Info(fmt.Sprintf("Updating bridge (%s channel)...", channel))
3535

36+
// Run from a temp directory so the install script's intermediate
37+
// files (e.g. curl -o bridge) don't conflict with the CWD.
38+
tmpDir, err := os.MkdirTemp("", "bridge-update-*")
39+
if err != nil {
40+
return fmt.Errorf("failed to create temp dir: %w", err)
41+
}
42+
defer os.RemoveAll(tmpDir)
43+
3644
cmd := exec.CommandContext(ctx, "sh", "-c", fmt.Sprintf("curl -fsSL %s | sh", scriptURL))
45+
cmd.Dir = tmpDir
3746
cmd.Stdin = os.Stdin
3847
cmd.Stdout = os.Stdout
3948
cmd.Stderr = os.Stderr

0 commit comments

Comments
 (0)