Skip to content

Write firmware uploads directly to the temp dir#2791

Open
mcrumm wants to merge 1 commit into
nerves-hub:mainfrom
mcrumm:mc-upload-writer
Open

Write firmware uploads directly to the temp dir#2791
mcrumm wants to merge 1 commit into
nerves-hub:mainfrom
mcrumm:mc-upload-writer

Conversation

@mcrumm

@mcrumm mcrumm commented Jun 24, 2026

Copy link
Copy Markdown

This change uses the Phoenix.LiveView.UploadWriter behaviour to avoid double-writing to temp when uploading firmware.

Note that there is an opportunity to better handle errors from the writer process, but I wanted to get feedback on change before taking it any further. Thanks!

The Firmware LiveView now utilizes the Phoenix.LiveView.UploadWriter
behaviour to write directly to a durable temp file. Once the upload is
complete, the FirmwareUploadWriter passes ownership of the temp file
to the LiveView process so that it survives after the writer process
exits.
@joshk

joshk commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Hey @mcrumm

This is a smart approach, I feel silly for not thinking of this. The double write always annoyed me.

Since FirmwareUploadWriter doesn't have anything specific to firmware in its code, it might be better to call this BrieflyUploadWriter.

Please do continue with this magic.

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.

2 participants