Hi,
I have a proposal for interactive plugins protocol. The patch consists
of two parts: libreport and abrt (example of usage on abrt-retrace-client).
For those who ignored my previous e-mail, here are some examples:
http://10.34.24.254/question-cli.png
http://10.34.24.254/question-gui.png
http://10.34.24.254/question-gui2.png
http://10.34.24.254/alert-gui.png
The protocol is simple. If REPORT_CLIENT_SLAVE env variable is set,
special messages are prefixed. GUI (or whatever) cuts off the prefixs,
shows a dialog and sends the response to child's stdin depending on the
pressed button. Otherwise standard stdin/stdout is used (awaiting direct
input from terminal). Here is an example of running the same analyzer
from slave and non-slave mode:
//slave - no terminal => stdin not accessible
Querying server settings
Preparing an archive to upload
ASK_YES_NO You are going to upload 16604 bytes. Continue?
//standard - running from terminal
Querying server settings
Preparing an archive to upload
You are going to upload 16604 bytes. Continue? [y/N]
The patch itself is not complete - it works with GUI, but breaks CLI.
This is because GUI and CLI are handling the output in a different way
and in my opinion these two should be changed one for the other.
The thing is that GUI reads output in 257 bytes long blocks instead of
reading line by line - this can easily break the idea of prefixed
messages (with the included patch one question works, multiple are
making problems). On the other hand, CLI reads the input line by line.
This is a problem if the plugin prints a question and waits for the
response on the same line (which seems to be correct for me, eg.
Are you sure you want to quit? [y/N] ). In the current situation the
program stucks waiting with no question displayed.
This is where I would like to begin a discussion - any ideas to figure
this out? Any ideas to improve the protocol? Anything else :)?
Cheers,
Michal