[Bro] External commands - Error
Bernhard Amann
bernhard at ICSI.Berkeley.EDU
Wed Apr 16 10:04:12 PDT 2014
Hi,
you have to use Exec::run inside of a when statement - because the command is run asynchronously results are not immediately available.
You can e.g. see https://github.com/bro/bro/blob/master/scripts/base/utils/dir.bro for an example that uses it.
Bernhard
On Apr 16, 2014, at 8:03 AM, Riccardo Bortolameotti <r.bortolameotti at gmail.com> wrote:
>
> Hello everybody,
>
> I am having a problem regarding external command execution.
>
> This is the piece of code:
> function f (s : string) : Exec::Result
> {
> local anagram : Exec::Command;
> local res : Exec::Result;
> res = [$exit_code = 0];
> local prog = "/home/riccardo/ngram-ids/ngram-ids/ngram-ids";
> local param = "-l /home/riccardo/ngram-ids/ngram-ids/save -m test -t 0 -U " + s;
> anagram = [$cmd = prog, $stdin = param];
> res = Exec::run(anagram);
> return res;
> }
> Basically the problem is that the variable res do not receive any value
> from the execution of the program. Since this execution should be run
> several times because is within a loop, I do not know if there are
> problems of threading (like wait for the result). I also receive an
> error like this:
>
> 1394205441.982764 warning: non-void function returns without a value:
> Exec::run
> 1394205441.982764 error: return trigger in context which does not allow
> delaying result
>
> thank you in advance,
>
> R.
>
> _______________________________________________
> Bro mailing list
> bro at bro-ids.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/bro
>
>
More information about the Bro
mailing list