The exec patch I sent cras did not capture stderr.  Instead stderr
output was just printed to the terminal, thus messing it up.

The patch against recent CVS content
(src/fe-common/core/fe-core-commands.c 1.18) below captures stderr on
systems conforming POSIX.2 (shell stuff, GNU libc does as recent
solaris versions do). This might work on other libc's but I don't have any
at hand *g*

Best regards,
Sascha AKA Tinuk

-- 
���`����,��,����`��������`����,��,����`��������`������`�

Index: fe-core-commands.c
===================================================================
RCS file: /home/cvs/irssi/src/fe-common/core/fe-core-commands.c,v
retrieving revision 1.18
diff -r1.18 fe-core-commands.c
20a21,22
> #include <features.h>
> 
306c308
< static void cmd_exec(const char *cmdline)
---
> static void cmd_exec(const char *data)
310c312
<       char *foo;
---
>       char *tmpstr;
313c315,329
<       stream = popen(cmdline, "r");
---
> #ifdef __USE_POSIX2
>         /* try to capture stderr by appending " 2>&1" */
>       tmpstr = malloc(strlen(data) + 6);
>       if (tmpstr) {
>               strcpy(tmpstr, data);
>               tmpstr = strcat(tmpstr, " 2>&1");
>               stream = popen(tmpstr, "r");
>               free(tmpstr);
>       } else {
>               stream = popen(data, "r");
>       }
> #else
>       stream = popen(data, "r");
> #endif
> 
324c340,341
<                   This is safer than using gets, though it is more work tbd
---
>                   This is safer than using gets, though it is more
>                   work tbd.
326,329c343,346
<               foo = tmpbuf;
<               while (*foo != '\0') {
<                       if (*foo == '\n') {
<                               *foo = '\0';
---
>               tmpstr = tmpbuf;
>               while (*tmpstr != '\0') {
>                       if (*tmpstr == '\n') {
>                               *tmpstr = '\0';
332c349
<                       foo++;
---
>                       tmpstr++;

Reply via email to