From 534ded210fc0e3321d308a2206235036874f3afc Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sun, 7 Apr 2024 09:29:17 +0100 Subject: [PATCH] Include TCL stack trace when --do fails --- src/rt/shell.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/rt/shell.c b/src/rt/shell.c index 2789095b..58e7f517 100644 --- a/src/rt/shell.c +++ b/src/rt/shell.c @@ -1455,8 +1455,17 @@ bool shell_do(tcl_shell_t *sh, const char *file) case TCL_ERROR: { const char *str = Tcl_GetStringResult(sh->interp); - if (str != NULL && *str != '\0') - errorf("%s", str); + if (str != NULL && *str != '\0') { + diag_t *d = diag_new(DIAG_ERROR, NULL); + diag_printf(d, "%s", str); + + const char *info = Tcl_GetVar(sh->interp, "::errorInfo", 0); + if (info != NULL) + diag_hint(d, NULL, "%s", info); + + diag_emit(d); + } + return false; } default: -- 2.39.2