Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

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

gleam / compiler-core / templates / gleam@@main.erl
964 B 35 lines
1-module('{{ application }}@@main'). 2 3-export([run/1]). 4 5run(Module) -> 6 io:setopts(standard_io, [binary, {encoding, utf8}]), 7 io:setopts(standard_error, [{encoding, utf8}]), 8 try 9 {ok, _} = application:ensure_all_started('{{ application }}'), 10 erlang:process_flag(trap_exit, false), 11 Module:main(), 12 erlang:halt(0) 13 catch 14 Class:Reason:StackTrace -> 15 print_error(Class, Reason, StackTrace), 16 erlang:halt(127, [{flush, true}]) 17 end. 18 19print_error(Class, Reason, StackTrace) -> 20 E = erl_error:format_exception( 21 1, Class, Reason, StackTrace, fun stack_filter/3, 22 fun print_stack_frame/2, unicode 23 ), 24 io:put_chars(E). 25 26stack_filter(Module, _F, _A) -> 27 case Module of 28 ?MODULE -> true; 29 erl_eval -> true; 30 init -> true; 31 _ -> false 32 end. 33 34print_stack_frame(Term, I) -> 35 io_lib:format("~." ++ integer_to_list(I) ++ "tP", [Term, 50]).