Hello:
In message <[email protected]>,
Marien Fressinaud writes:
>I'm facing a problem to get result of SEC standard error. I'm currently
>writing a software in Python which starts SEC as a subprocess and tests
>if a rule file is well-written. So I try to catch SEC standard error to
>get something like:
>./rules.sec line 1 (test line): Line not in keyword=value format or
>non-alphanumeric keyword
>
>## What did I try and what is the result?
>Since I didn't have anything on standard output / error in Python, I
>tried these commands in a terminal:
>
>$ ./sec --input=- --debug=3 --no-tail --conf=./rules.sec
>./rules.sec line 1 (test line): Line not in keyword=value format or
>non-alphanumeric keyword
>
>Result is what I expected so I tried then:
>
>$ ./sec --input=- --debug=3 --no-tail --conf=./rules.sec
>2>error_file.txt
>$ cat error_file.txt
>
>... But there was nothing in my file!
>
>I'm running on an updated Manjaro (~ Arch) distribution with Gnome
>Terminal 3.12.
>SEC is in v2.7.6.
Note in the man page for SEC the --log argument is described:
--log=<logfile>
use <logfile> for logging SEC activities. Note that if the SEC
standard error is connected to a terminal, messages will also be
logged there, in order to facilitate debugging.
So that looks like the only way to capture stderr is to run SEC under
a pty (pseudoterminal). If you want to choose this solution, I
suggest reading up on the pexpect python library which I think will do
that.
You could try:
$ ./sec --input=- --debug=3 --no-tail --conf=./rules.sec --log error_file.txt
and parse error_file.txt which will have the output from sec that
normally would be sent to stderr if you were on a terminal.
Also if you are only checking syntax errors, you may want --testonly
as well. I am not sure if that flag stops stderr redirection though.
>I don't know if this is a bug or if I'm doing something wrong, but maybe
>someone has already faced this kind of problem?
Given the man page entry, I would say it works as designed.
--
-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
------------------------------------------------------------------------------
_______________________________________________
Simple-evcorr-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users