diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-06 14:41:34 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-06 14:41:34 -0400 |
| commit | 176205a22de8bc356109edc2aceaaa07ae1d24a4 (patch) | |
| tree | 25d1f9052c940be4fcd8d38a38d23e377d6d7c56 /environment.c | |
| parent | 817235cfbc3162e136d53ec5bffe234d4d87c79b (diff) | |
Print stack trace if $TOMO_STACKTRACE is set
Diffstat (limited to 'environment.c')
| -rw-r--r-- | environment.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/environment.c b/environment.c index 39a3e24a..0c37b266 100644 --- a/environment.c +++ b/environment.c @@ -3,11 +3,12 @@ #include <stdlib.h> #include <signal.h> -#include "environment.h" +#include "builtins/functions.h" #include "builtins/table.h" #include "builtins/text.h" -#include "typecheck.h" #include "builtins/util.h" +#include "environment.h" +#include "typecheck.h" type_t *TEXT_TYPE = NULL; type_t *RANGE_TYPE = NULL; @@ -588,6 +589,9 @@ void compiler_err(file_t *f, const char *start, const char *end, const char *fmt if (f && start && end) highlight_error(f, start, end, "\x1b[31;1m", 2, isatty(STDERR_FILENO) && !getenv("NO_COLOR")); + if (getenv("TOMO_STACKTRACE")) + print_stack_trace(stderr, 1, 3); + raise(SIGABRT); exit(1); } |
