Skip to content

Commit 0b950fe

Browse files
committed
fix: split erlang CLI args to prevent BEAM hang with spawn+wait
Passing '-elixir ansi_enabled true' and '-s elixir start_cli' as single argv entries (with embedded spaces) caused the BEAM to hang in __select when spawned via std.process.spawn on macOS. erlexec passes them through to beam.smp as-is, and beam.smp doesn't split space-delimited args. Splitting them into separate argv entries fixes the hang.
1 parent 05e7402 commit 0b950fe

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/erlang_launcher.zig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ pub fn launch(io: Io, install_dir: []const u8, env_map: *std.process.Environ.Map
5252

5353
const erlang_cli = &[_][]const u8{
5454
erl_bin_path[0..],
55-
"-elixir ansi_enabled true",
55+
"-elixir",
56+
"ansi_enabled",
57+
"true",
5658
"-noshell",
57-
"-s elixir start_cli",
59+
"-s",
60+
"elixir",
61+
"start_cli",
5862
"-mode embedded",
5963
"-setcookie",
6064
release_cookie_content,
@@ -96,6 +100,8 @@ pub fn launch(io: Io, install_dir: []const u8, env_map: *std.process.Environ.Map
96100
}
97101
}
98102

103+
// Spawn child and wait for exit.
104+
// The BEAM's exit code becomes the Burrito binary's exit code.
99105
var child = try std.process.spawn(io, .{
100106
.argv = final_args,
101107
.environ_map = env_map,

0 commit comments

Comments
 (0)