Skip to content

1.6.0: -mode embedded is passed as a single argv element, so releases boot in interactive mode #233

Description

@ryanwinchester

Host

Host OS: macOS 26.5.2
Host CPU: aarch64 (Apple Silicon)

zig version: 0.16.0
elixir -v: Elixir 1.20.3 (compiled with Erlang/OTP 29)
Burrito: 1.6.0 (Hex)

Target

Same as host.


src/erlang_launcher.zig passes -mode embedded to the emulator as a single argv element:

"-mode embedded",

erl does not split argv elements, so init never recognizes the flag and the VM boots in interactive mode. #225 fixed exactly this class of bug for "-s elixir start_cli" and "-elixir ansi_enabled true" ("passing them as single strings caused..."), and #229 documents the 1.5.0 consequence of the joined -s — but -mode was missed.

Repro (no project needed)

$ erl "-mode embedded" -noshell -eval 'io:format("~p ~p~n",[code:get_mode(), init:get_argument(mode)]),halt().'
interactive error

$ erl -mode embedded -noshell -eval 'io:format("~p ~p~n",[code:get_mode(), init:get_argument(mode)]),halt().'
embedded {ok,[["embedded"]]}

Inside a Burrito 1.6.0 binary, :init.get_argument(:mode) returns :error and code:get_mode() returns :interactive.

Consequences

Releases silently lose embedded-mode semantics:

  • Modules are loaded lazily instead of preloaded at boot, so function_exported?/3 returns false for modules that haven't been called yet. We hit this as real user-visible misbehavior: a framework that gates optional callbacks on function_exported?/3 silently skipped an app's mount callback only inside the Burrito binary.
  • The fail-fast guarantee of embedded mode (boot errors on missing modules) is lost.

Fix

Split the element:

"-mode",
"embedded",

Verified locally by patching deps/burrito: the flag is parsed and code:get_mode() returns :embedded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions