mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-24 03:18:22 +00:00
escript_runtime: remove support for OTP < 21
This commit is contained in:
parent
3727dfbcc9
commit
b96d413aaf
@ -1,7 +1,7 @@
|
||||
%%% -*- erlang-indent-level: 2 -*-
|
||||
%%%
|
||||
%%% Runtime support for stand-alone programs started as escripts.
|
||||
%%% Copyright (C) 2018 Mikael Pettersson
|
||||
%%% Copyright (C) 2018-2019 Mikael Pettersson
|
||||
%%%
|
||||
%%% This file is part of pdp10-tools.
|
||||
%%%
|
||||
@ -27,22 +27,12 @@
|
||||
, start/2
|
||||
]).
|
||||
|
||||
%% TODO: drop these macros when dropping support for OTP < OTP-21
|
||||
-ifdef(OTP_RELEASE). % >= OTP-21
|
||||
-define(EXN_WITH_STACKTRACE(Class, Reason, Stacktrace), Class:Reason:Stacktrace).
|
||||
-define(GET_STACKTRACE(Stacktrace), ok).
|
||||
-else. % < OTP-21
|
||||
-define(EXN_WITH_STACKTRACE(Class, Reason, Stacktrace), Class:Reason).
|
||||
-define(GET_STACKTRACE(Stacktrace), Stacktrace = erlang:get_stacktrace()).
|
||||
-endif.
|
||||
|
||||
%% escript logs unhandled exceptions to standard output, but we want them to
|
||||
%% end up on standard error
|
||||
start(Main, Argv) ->
|
||||
try
|
||||
Main(Argv)
|
||||
catch ?EXN_WITH_STACKTRACE(Class, Reason, Stacktrace) ->
|
||||
?GET_STACKTRACE(Stacktrace),
|
||||
catch Class:Reason:Stacktrace ->
|
||||
fmterr("~s: Unhandled exception ~p:~p\n~p\n", [progname(), Class, Reason, Stacktrace]),
|
||||
halt(1)
|
||||
end.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user