Changes in / [0a9ffc5:7c539a8]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r8135737 r4d9e311c  
    1212#include <sys/stat.h>
    1313#include <locale.h>
     14#include <unistd.h>
    1415
    1516#if OWL_STDERR_REDIR
     
    427428  if (0 != pipe(pipefds)) {
    428429    perror("pipe");
    429     owl_function_debugmsg("stderr_replace: pipe FAILED\n");
     430    owl_function_debugmsg("stderr_replace: pipe FAILED");
    430431    return -1;
    431432  }
    432     owl_function_debugmsg("stderr_replace: pipe: %d,%d\n", pipefds[0], pipefds[1]);
    433   if (-1 == dup2(pipefds[1], 2 /*stderr*/)) {
    434     owl_function_debugmsg("stderr_replace: dup2 FAILED (%s)\n", strerror(errno));
     433    owl_function_debugmsg("stderr_replace: pipe: %d,%d", pipefds[0], pipefds[1]);
     434  if (-1 == dup2(pipefds[1], STDERR_FILENO)) {
     435    owl_function_debugmsg("stderr_replace: dup2 FAILED (%s)", strerror(errno));
    435436    perror("dup2");
    436437    return -1;
     
    514515#if OWL_STDERR_REDIR
    515516  /* Do this only after we've started curses up... */
    516   owl_function_debugmsg("startup: doing stderr redirection");
    517   channel = g_io_channel_unix_new(stderr_replace());
    518   g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR, &stderr_redirect_handler, NULL);
    519   g_io_channel_unref(channel);
     517  if (isatty(STDERR_FILENO)) {
     518    owl_function_debugmsg("startup: doing stderr redirection");
     519    channel = g_io_channel_unix_new(stderr_replace());
     520    g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR, &stderr_redirect_handler, NULL);
     521    g_io_channel_unref(channel);
     522  }
    520523#endif
    521524
Note: See TracChangeset for help on using the changeset viewer.