Skip to content

prim_tty:init(#{}). does not work on macOS #10174

@Stanislav-Lapata

Description

@Stanislav-Lapata

Describe the bug
Gazler/termite#4
prim_tty does not work on macOS

macOS: Version 15.6.1 (24G90)
Processor: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Terminals: Alacritty and Terminal.app
shells: fish and bash

I checked the same code on Linux and it works.

To Reproduce
run iex and :prim_tty.init(%{})
or run erl and prim_tty:init(#{}).

Expected behavior
Should return tty state

Affected versions
erlang 28.0.2
elixir 1.18.4-otp-28

Additional context
exception from iex

** (EXIT from #PID<0.115.0>) shell process exited with reason: an exception was raised:
    ** (MatchError) no match of right hand side value: []
        (kernel 10.3.2) prim_tty.erl:673: :prim_tty.set_name/2
        (kernel 10.3.2) prim_tty.erl:638: :prim_tty.writer/1
        (stdlib 7.0.2) proc_lib.erl:333: :proc_lib.init_p_do_apply/3

exception from erl

=CRASH REPORT==== 8-Sep-2025::15:49:30.707721 ===
  crasher:
    initial call: prim_tty:writer/1
    pid: <0.97.0>
    registered_name: []
    exception error: no match of right hand side value []
      in function  prim_tty:set_name/2 (prim_tty.erl:673)
      in call from prim_tty:writer/1 (prim_tty.erl:638)
    ancestors: [<0.95.0>,<0.72.0>,<0.70.0>,user_drv,<0.69.0>,<0.65.0>,
                  kernel_sup,<0.47.0>]
    message_queue_len: 0
    messages: []
    links: [<0.95.0>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 233
    stack_size: 29
    reductions: 35
  neighbours:
    neighbour:
      pid: <0.95.0>
      registered_name: []
      initial_call: {erlang,apply,2}
      current_function: {proc_lib,sync_start,2}
      ancestors: [<0.72.0>,<0.70.0>,user_drv,<0.69.0>,<0.65.0>,kernel_sup,
                  <0.47.0>]
      message_queue_len: 0
      links: [<0.72.0>,<0.97.0>]
      trap_exit: false
      status: waiting
      heap_size: 233
      stack_size: 35
      reductions: 1801
      current_stacktrace: [{proc_lib,sync_start,2,[{file,"proc_lib.erl"},{line,438}]},
                  {prim_tty,init_term,1,[{file,"prim_tty.erl"},{line,294}]},
                  {erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,924}]},
                  {shell,exprs,7,[{file,"shell.erl"},{line,937}]},
                  {shell,eval_exprs,7,[{file,"shell.erl"},{line,893}]},
                  {shell,eval_loop,4,[{file,"shell.erl"},{line,878}]}]
** exception exit: {badmatch,[]}
     in function  prim_tty:set_name/2 (prim_tty.erl:673)
     in call from prim_tty:writer/1 (prim_tty.erl:638)
     in call from proc_lib:init_p_do_apply/3 (proc_lib.erl:333)

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugteam:VMAssigned to OTP team VM

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions