On Tuesday 08 January 2008 19:24:28 Werner Hoch wrote:
> Hi Peter and all,
>
> I'm currently playing with the library command api.
>
> I was curious why the function does not catch the error if I return 1
> from my library command.
>
> I've added the following 3 lines to the function:
> ------------
> diff --git a/libgeda/src/s_clib.c b/libgeda/src/s_clib.c
> index fc4d437..3aab9ef 100644
> --- a/libgeda/src/s_clib.c
> +++ b/libgeda/src/s_clib.c
> @@ -450,6 +450,10 @@ static gchar *run_source_command (const gchar
> *command)
>                               &exit_status,
>                               &e);
>
> +  if (standard_error && exit_status == 0)
> +    s_log_message("%s", standard_error);
> +  printf("%d, %d, %d, %s\n", exit_status, WIFSIGNALED(exit_status),
> WIFEXITED(exit_status), (e != NULL)?e->message:"NULL");
> +
>    if (e != NULL) {
>      s_log_message (_("Library command failed [%s]: %s\n"), command,
>                    e->message);
> ------------
>
> And got the following result on the command line:
> 0, 0, 1, NULL
> 0, 0, 1, NULL
> 0, 0, 1, NULL
> 0, 0, 1, NULL
> 256, 0, 1, NULL
> 256, 0, 1, NULL
>
> In the first 4 lines I've returned 0 in my script, in the last lines
> I've returned 1. I wrote to stderr in all 6 cases.
>
> The error handling just never catched an error from my command line.
>
>
> Some notes about the first two lines I've added:
> +  if (standard_error && exit_status == 0)
> +    s_log_message("%s", standard_error);
>
> I need to forward some log informations from my library command to the
> gschem status dialog, even if the query was successful.
>
> I'll write some more lines about the purpose later.
>

That's a very odd bug you've turned up.  It may be due to a bug in GLib.  I'd 
love to see a patch if you can get it working (I'll be back in the UK later 
today, and I'll have a fiddle with it myself then).

Just a note: I hope that printf() is going to disappear; there aren't meant to 
be any in libgeda any more! :P

                                     Peter


-- 
Peter Brett

Electronic Systems Engineer
Integral Informatics Ltd

Attachment: signature.asc
Description: This is a digitally signed message part.


_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to