@@ -50,22 +50,28 @@ defmodule IEx.CLI do
50
50
a dumb terminal version is started instead.
51
51
"""
52
52
def start do
53
- if tty_works? ( ) do
54
- :user_drv . start ( [ :"tty_sl -c -e" , tty_args ( ) ] )
55
- else
56
- if get_remsh ( :init . get_plain_arguments ( ) ) do
57
- IO . puts (
58
- :stderr ,
59
- "warning: the --remsh option will be ignored because IEx is running on limited shell"
60
- )
61
- end
53
+ # TODO: We can remove the -user callback on Erlang/OTP 26+ in favor of eval
54
+ cond do
55
+ Code . ensure_loaded? ( :prim_tty ) ->
56
+ :user_drv . start ( % { initial_shell: tty_args ( ) } )
57
+
58
+ tty_works? ( ) ->
59
+ :user_drv . start ( [ :"tty_sl -c -e" , tty_args ( ) ] )
60
+
61
+ true ->
62
+ if get_remsh ( :init . get_plain_arguments ( ) ) do
63
+ IO . puts (
64
+ :stderr ,
65
+ "warning: the --remsh option will be ignored because IEx is running on limited shell"
66
+ )
67
+ end
62
68
63
- :user . start ( )
69
+ :user . start ( )
64
70
65
- # IEx.Broker is capable of considering all groups under user_drv but
66
- # when we use :user.start(), we need to explicitly register it instead.
67
- # If we don't register, pry doesn't work.
68
- IEx . start ( [ register: true ] ++ options ( ) , { :elixir , :start_cli , [ ] } )
71
+ # IEx.Broker is capable of considering all groups under user_drv but
72
+ # when we use :user.start(), we need to explicitly register it instead.
73
+ # If we don't register, pry doesn't work.
74
+ IEx . start ( [ register: true ] ++ options ( ) , { :elixir , :start_cli , [ ] } )
69
75
end
70
76
end
71
77
0 commit comments