[Bro-Dev] open a pipe?
seth at icir.org
Tue Mar 27 08:41:29 PDT 2012
On Mar 27, 2012, at 10:21 AM, Robin Sommer wrote:
> Regarding what the interface looks like, there are a number of
> options. Using "when" is one, we could indeed feed in there. But I'm
> not sure it's right model here: when would work best for simple
> one-request-one-reply style I/O but with pipes we may want more: keep
> writing into it, and keep reading out. That would work better with a
> file-like object ones prints to, and any output turning into events.
> But there may be still better models that that.
I keep thinking that we just need to provide the connection between the input framework and sub processes. From the script-land perspective, something like this maybe?
# The sub process is defined
# STDIN is connected to a Bro file.
local sha_command = SubProcess::get_stdin("sha_hash");
# STDERR and STDOUT are connected to inputs
# The subprocess is actually executed.
# Send data to STDIN of the command.
print sha_command, "some data";
# The command dies and the input streams are destroyed.
I think that SubProcess::get_stdout and SubProcess::get_stderr would return strings (file names) and SubProcess::get_stdin would return a file typed variable. It's all pretty verbose, but I don't think we have many options to keep things async and functional with the event loop. Thoughts?
International Computer Science Institute
(Bro) because everyone has a network
More information about the bro-dev