Skip to content

refactor: streamline PNG rendering by removing temporary file usage#6

Open
rajarshidattapy wants to merge 1 commit into
bolna-ai:mainfrom
rajarshidattapy:fix/png-export-windows
Open

refactor: streamline PNG rendering by removing temporary file usage#6
rajarshidattapy wants to merge 1 commit into
bolna-ai:mainfrom
rajarshidattapy:fix/png-export-windows

Conversation

@rajarshidattapy

Copy link
Copy Markdown

What

Fixes #4

renderCardToPNG (internal/cli/freeze.go) built freeze --execute "cat " + tmpfile, which broke bolna agents view <id> --png out.png two ways:

  1. Windows: cat isn't on a standard Windows PATH, so --execute had nothing to run — --png couldn't work at all.
  2. Spaces: freeze word-splits the --execute string, so any temp path with a space (e.g. C:\Users\John Doe\bolna-card-123.ansi) split into two args and failed — on any OS whose temp path contains a space.

Fix

Pipe the ANSI card to freeze's stdin instead of shelling out to cat. This is freeze's documented cat art.ansi | freeze usage — it reads and auto-detects ANSI on stdin. Both bugs die at the root: no cat dependency, and no temp file at all, so there's no path that could contain a space.

Also deletes the whole temp-file dance (os.CreateTemp, WriteString, Close, defer Remove) — −12 lines, smaller than the file-arg approach the issue suggested.

Verification

  • go build ./..., go vet, go test ./... all pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Title: --png export is broken on Windows and on any temp path containing a space

1 participant