mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 15:18:20 +00:00

- Do stream mode for commands done by exec module, it seems important in some cases (e.g. ensure requested stdin is fully written). - For cases where the raw input reader knows the child process has been reaped, set the childpid member to a sentinel value to indicate such so we don't later think we should kill it or wait on it anymore. - More error checking on dup2/close calls. Set sentinel values when closing ends of pipes to prevent double closing a fd. - Signal flag not set when raw input reader's child exits as a result of a signal. Left out a test for this -- might be portability issues (e.g. Ubuntu seems to do things different regarding the exit code and also is printing "Killed" to stderr where other platforms don't).
64 lines
1.1 KiB
Text
64 lines
1.1 KiB
Text
# @TEST-EXEC: btest-bg-run bro bro -b ../dirtest.bro
|
|
# @TEST-EXEC: btest-bg-wait 15
|
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff bro/.stdout
|
|
|
|
@TEST-START-FILE dirtest.bro
|
|
|
|
@load base/utils/dir
|
|
@load base/frameworks/communication # let network-time run. otherwise there are no heartbeats...
|
|
redef exit_only_after_terminate = T;
|
|
|
|
global c: count = 0;
|
|
|
|
function check_terminate_condition()
|
|
{
|
|
c += 1;
|
|
|
|
if ( c == 10 )
|
|
terminate();
|
|
}
|
|
|
|
function new_file1(fname: string)
|
|
{
|
|
print "new_file1", fname;
|
|
check_terminate_condition();
|
|
}
|
|
|
|
function new_file2(fname: string)
|
|
{
|
|
print "new_file2", fname;
|
|
check_terminate_condition();
|
|
}
|
|
|
|
event change_things()
|
|
{
|
|
system("touch ../testdir/newone");
|
|
system("rm ../testdir/bye");
|
|
}
|
|
|
|
event change_things2()
|
|
{
|
|
system("touch ../testdir/bye");
|
|
}
|
|
|
|
event bro_init()
|
|
{
|
|
Dir::monitor("../testdir", new_file1, .5sec);
|
|
Dir::monitor("../testdir", new_file2, 1sec);
|
|
schedule 3sec { change_things() };
|
|
schedule 6sec { change_things2() };
|
|
}
|
|
|
|
@TEST-END-FILE
|
|
|
|
@TEST-START-FILE testdir/hi
|
|
123
|
|
@TEST-END-FILE
|
|
|
|
@TEST-START-FILE testdir/howsitgoing
|
|
abc
|
|
@TEST-END-FILE
|
|
|
|
@TEST-START-FILE testdir/bye
|
|
!@#
|
|
@TEST-END-FILE
|