diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-07-06 06:01:01 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-07-06 06:01:01 -0700 |
commit | 7a926eb8da998fba873900fadc4f2fa179e7319f (patch) | |
tree | 67617f9cf2c4cb0bedc03c70d6c82da0d6a92a67 /stream.c | |
parent | da442bbb28b7df94d730aba0ed46064ff2ffd9cb (diff) | |
download | txr-7a926eb8da998fba873900fadc4f2fa179e7319f.tar.gz txr-7a926eb8da998fba873900fadc4f2fa179e7319f.tar.bz2 txr-7a926eb8da998fba873900fadc4f2fa179e7319f.zip |
unwind: refer to top-level *stderr* stream.
Exception processing should refer to the original, top-level
value of *stderr* rather than the current dynamic value, even
if unwinding has not yet taken place. Using the dynamic value
can not only cause critical output to disappear, but it leads
to a false positive identification of the "unhandled exception
in early initialization" situation, a diagnostic which is
emitted on the C stderr if the Lisp one is unavailable,
which is assumed to be due to initialization not having
yet completed.
* stream.c (top_stderr): New global variable.
(stream_init): GC-protect top_stderr, and initialize it with
the same object that goes into the *stderr* top-level binding.
* stream.h (top_stderr): Declared.
* unwind.c (uw_unwind_to_exit_point, uw_rthrow): Use
top_stderr instead of std_error macro.
Diffstat (limited to 'stream.c')
-rw-r--r-- | stream.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -101,6 +101,8 @@ val socket_error_s; const wchli_t *path_sep_chars = wli("/"); +val top_stderr; + val shell, shell_arg; void strm_base_init(struct strm_base *s) @@ -5253,6 +5255,7 @@ void stream_init(void) { prot1(&ap_regex); prot1(&plp_regex); + prot1(&top_stderr); detect_format_string(); detect_path_separators(); @@ -5298,7 +5301,7 @@ void stream_init(void) reg_var(stddebug_s = intern(lit("*stddebug*"), user_package), make_stdio_stream(stdout, lit("debug"))); reg_var(stderr_s = intern(lit("*stderr*"), user_package), - make_stdio_stream(stderr, lit("stderr"))); + top_stderr = make_stdio_stream(stderr, lit("stderr"))); reg_var(stdnull_s = intern(lit("*stdnull*"), user_package), make_null_stream()); |