gst-inspect: Pipe stderr to pager as well
authorZeeshan Ali <zeenix@collabora.co.uk>
Fri, 9 Nov 2018 10:34:19 +0000 (11:34 +0100)
committerSebastian Dröge <slomo@coaxion.net>
Fri, 9 Nov 2018 12:27:18 +0000 (12:27 +0000)
If stderr is not redirected by the user, also page that.

tools/gst-inspect.c

index e3e3c38..c9f407a 100644 (file)
@@ -1752,6 +1752,8 @@ redirect_stdout (void)
   } else {
     close (pipefd[0]);
     dup2 (pipefd[1], STDOUT_FILENO);
+    if (isatty (STDERR_FILENO))
+      dup2 (pipefd[1], STDERR_FILENO);
     close (pipefd[1]);
     close (STDIN_FILENO);
   }
@@ -1952,8 +1954,10 @@ main (int argc, char *argv[])
 
 #ifdef G_OS_UNIX
   fflush (stdout);
+  fflush (stderr);
   /* So that the pipe we create in redirect_stdout() is closed */
   close (STDOUT_FILENO);
+  close (STDERR_FILENO);
   wait (NULL);
 #endif