Skip to content

Stream a new box's first-run setup into the create dialog - #219

Open
kacperpaczos wants to merge 2 commits into
Dvlv:masterfrom
kacperpaczos:feat/stream-setup-phase
Open

Stream a new box's first-run setup into the create dialog#219
kacperpaczos wants to merge 2 commits into
Dvlv:masterfrom
kacperpaczos:feat/stream-setup-phase

Conversation

@kacperpaczos

Copy link
Copy Markdown
Contributor

When you create a box, the streaming dialog shows the output of distrobox create — but create only writes the container's config. The real work (Starting container…, Installing basic packages…, and the rest) happens the first time the box is entered, and until now that scrolled past in the terminal we opened afterwards instead of in the dialog you were already watching.

This runs a throwaway no-op enter (distrobox enter <box> -- true) right after create, streamed through the exact same channel, so the first-run setup shows up in the dialog too. By the time the dialog closes, the box is genuinely built and ready.

The per-command spawn/stream/wait logic is factored into one stream_distrobox helper that both the create pass and the setup pass go through, so both stream identically. The dialog already waited on the producer finishing rather than on any single stream, so it needed no changes. The enter arguments are a small pure function with a unit test, and the existing end-to-end streaming test now also asserts the box responds to a command once the stream is done (i.e. setup actually completed).

distrobox create only writes the container config; the container is built on
its first enter, which is where "Starting container" / "Installing basic
packages" come from. That setup used to run in the terminal opened after
creating. Trigger it with a no-op `distrobox enter -- true` right after create
and stream it through the same channel, so the dialog shows the setup too and
the box is genuinely ready by the time it closes.

Factor the spawn/stream/wait into one stream_distrobox helper shared by both
passes. The enter arguments are a small pure function with a unit test, and the
e2e test now also checks the box runs a command once the stream is done.
A helper that returned a four-element literal, and a test that compared
it to the same literal, added nothing over writing the arguments at the
call site. The end-to-end test (ignored by default) still checks that
the streamed create leaves a ready box.
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.

1 participant