A bunch of more changes for the raw reader

* send end_of_data event for all kind of streams
* send process_finished event containing exit code of child process for executed programs
* move raw-tests to separate directory
* expose name of input stream to readers
* better handling of some error cases in raw reader
* new force_kill option for raw reader which SIGKILLs progesses on exit

The ordering of events how they arrive in the main loop is a bit peculiar at the moment.
The process_finished event arrives in scriptland before all of the other events, even though
it should be sent last. I have not yet fully figured that out.
This commit is contained in:
Bernhard Amann 2013-03-18 21:49:16 -07:00
parent f1c91f02ce
commit 8875953751
21 changed files with 166 additions and 174 deletions

View file

@ -4,8 +4,6 @@
redef exit_only_after_terminate = T;
module A;
type Val: record {
s: string;
is_stderr: bool;
@ -16,7 +14,6 @@ global outfile: file;
event line(description: Input::EventDescription, tpe: Input::Event, s: string, is_stderr: bool)
{
print outfile, description;
print outfile, tpe;
print outfile, s;
print outfile, is_stderr;
@ -25,12 +22,25 @@ event line(description: Input::EventDescription, tpe: Input::Event, s: string, i
if ( try == 7 )
{
print outfile, "done";
close(outfile);
Input::remove("input");
terminate();
}
}
event Input::end_of_data(name: string, source:string)
{
print outfile, "End of Data event";
print outfile, name;
terminate(); # due to the current design, end_of_data will be called after process_finshed and all line events.
# this could potentially change
}
event InputRaw::process_finished(name: string, source:string, exit_code:count, signal_exit:bool)
{
print outfile, "Process finished event";
print outfile, name;
print outfile, exit_code;
}
event bro_init()
{