Always emit scripting errors to stderr during zeek_init

Otherwise, setting Reporter::errors_to_stderr=F causes important
error messages to be lost (and this setting is the default for
ZeekCtl).  E.g. now that we terminate if there's errors during
zeek_init, GH-369 shows that the only error message given was
"fatal error: errors occurred while initializing", which is not
helpful in determining the actual issue.
This commit is contained in:
Jon Siwek 2019-05-17 14:13:46 -07:00
parent 9d07e4f0b8
commit dd173f4961
6 changed files with 34 additions and 9 deletions

View file

@ -7,7 +7,14 @@ redef Reporter::errors_to_stderr = F;
global test: table[count] of string = {};
event zeek_init()
event my_event()
{
print test[3];
}
event zeek_init()
{
# Errors within zeek_init are always printed to stderr, so check whether
# an error that happens later is suppressed.
schedule 0.2sec { my_event() };
}