Skip to content

Split -mode embedded into separate argv elements - #236

Open
ryanwinchester wants to merge 1 commit into
burrito-elixir:mainfrom
ryanwinchester-forks:fix/233-split-mode-embedded
Open

Split -mode embedded into separate argv elements#236
ryanwinchester wants to merge 1 commit into
burrito-elixir:mainfrom
ryanwinchester-forks:fix/233-split-mode-embedded

Conversation

@ryanwinchester

Copy link
Copy Markdown

Fixes #233.

erl does not split argv elements, so passing "-mode embedded" as a single element means init never recognizes the flag and the VM silently boots in interactive mode. #225 fixed exactly this class of bug for "-s elixir start_cli" and "-elixir ansi_enabled true", but -mode was missed.

Dependency-free demonstration:

$ 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"]]}

Verification

Probe app wrapped with this branch, run on macOS 26 arm64 (Zig 0.16.0), printing from Application.start/2:

stock 1.6.0 this PR
:code.get_mode() :interactive :embedded
:init.get_argument(:mode) :error {:ok, [[~c"embedded"]]}

Note: this branch is independent of #235 but touches an adjacent region of erlang_launcher.zig; if both land there may be a trivial conflict to resolve.

erl does not split argv elements, so a single "-mode embedded" string
is not recognized as a flag and the VM silently boots in interactive
mode: init:get_argument(mode) returns error and code:get_mode()
returns interactive. Modules are loaded lazily instead of preloaded,
and embedded mode's fail-fast guarantee on missing modules is lost.

Same class of bug fixed in burrito-elixir#225 for "-s elixir start_cli" and
"-elixir ansi_enabled true"; -mode was missed.

Verified in a wrapped app on macOS 26 arm64 (zig 0.16.0):

  before: code:get_mode() = interactive, init:get_argument(mode) = error
  after:  code:get_mode() = embedded,    init:get_argument(mode) = {ok,[["embedded"]]}

Fixes burrito-elixir#233
@ryanwinchester ryanwinchester changed the title Split -mode embedded into separate argv elements Split -mode embedded into separate argv elements Aug 19, 2026
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.6.0: -mode embedded is passed as a single argv element, so releases boot in interactive mode

1 participant