A structured-data shell in Gleam, inspired by Nushell
0

Configure Feed

Select the types of activity you want to include in your feed.

Handle port EXIT in PTY collect loops under trapped exits.

When the caller traps exits, a closed port delivers {'EXIT', Port, Reason}
instead of {Port, {exit_status, _}}. Treat that as interrupt status 130 so
epipe is not fatal during password prompts and post-interrupt cleanup.

author
nandi
date (Jul 25, 2026, 2:11 AM -0700) commit 731128ff parent 6e1dd132 change-id tpxrsrww
+8 -1
+8 -1
src/gleshell_ffi.erl
··· 1899 1899 1900 1900 %% PTY session: no timeout (password prompts, long pagers, etc.). 1901 1901 %% Ctrl+C is handled in io_to_port/1 (SIGINT); also accept interrupt msgs. 1902 + %% Caller must run under with_trapped_exits/1 so port epipe is not fatal. 1902 1903 collect_output_relay(Port, Tty, Acc) -> 1903 1904 receive 1904 1905 {Port, {data, Data}} when is_binary(Data) -> ··· 1910 1911 collect_output_relay(Port, Tty, <<Acc/binary, Bin/binary>>); 1911 1912 {Port, {exit_status, Status}} -> 1912 1913 {ok, {Status, normalize_pty_output(Acc)}}; 1914 + {'EXIT', Port, _Reason} -> 1915 + {ok, {130, normalize_pty_output(Acc)}}; 1913 1916 {gleshell_interrupt, _} -> 1914 1917 signal_port_group(Port, int), 1915 1918 collect_output_relay_after_interrupt(Port, Tty, Acc, 2000) ··· 1930 1933 ); 1931 1934 {Port, {exit_status, Status}} -> 1932 1935 {ok, {Status, normalize_pty_output(Acc)}}; 1936 + {'EXIT', Port, _Reason} -> 1937 + {ok, {130, normalize_pty_output(Acc)}}; 1933 1938 {gleshell_interrupt, _} -> 1934 1939 signal_port_group(Port, kill), 1935 1940 collect_output_relay_after_interrupt(Port, Tty, Acc, 1000) ··· 1938 1943 catch port_close(Port), 1939 1944 receive 1940 1945 {Port, {exit_status, Status}} -> 1941 - {ok, {Status, normalize_pty_output(Acc)}} 1946 + {ok, {Status, normalize_pty_output(Acc)}}; 1947 + {'EXIT', Port, _} -> 1948 + {ok, {130, normalize_pty_output(Acc)}} 1942 1949 after 1000 -> 1943 1950 {ok, {130, normalize_pty_output(Acc)}} 1944 1951 end