gst-inspect: Allow overriding DEFAULT_LESS_OPTS with GST_LESS

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/777>
This commit is contained in:
Jan Alexander Steffens (heftig) 2021-03-19 13:46:13 +01:00 committed by GStreamer Marge Bot
parent defe732ae0
commit 10b38146e8
2 changed files with 20 additions and 2 deletions

View file

@ -81,6 +81,17 @@ Enable printout of errors while loading \fIGStreamer\fP plugins
.B \-\-gst\-plugin\-path=PATH
Add directories separated with ':' to the plugin search path
.
.SH "ENVIRONMENT VARIABLES"
.l
\fIgst\-inspect\-1.0\fP reads the following environment variables, in addition
to the generic \fIGStreamer\fP environment variables also described in
.BR gst\-launch\-1.0 (1):
.TP 8
.B GST_LESS
Override the options passed to \fIless\fR (by default "RXF").
.br
See \fBless\fR(1) for more information.
.
.SH "SEE ALSO"
.BR gst\-launch\-1.0 (1),
.BR gst\-typefind\-1.0 (1)

View file

@ -45,6 +45,9 @@
/* "R" : support color
* "X" : do not clear the screen when leaving the pager
* "F" : skip the pager if content fit into the screen
*
* Don't forget to update the manpage gst-inspect-1.0.1
* after changing this default.
*/
#define DEFAULT_LESS_OPTS "RXF"
@ -1949,7 +1952,7 @@ redirect_stdout (void)
{
GError *error = NULL;
gchar **argv;
const gchar *pager;
const gchar *pager, *less;
gint stdin_fd;
gchar **envp;
@ -1959,8 +1962,12 @@ redirect_stdout (void)
argv = g_strsplit (pager, " ", 0);
less = g_getenv ("GST_LESS");
if (less == NULL)
less = DEFAULT_LESS_OPTS;
envp = g_get_environ ();
envp = g_environ_setenv (envp, "LESS", DEFAULT_LESS_OPTS, TRUE);
envp = g_environ_setenv (envp, "LESS", less, TRUE);
if (!g_spawn_async_with_pipes (NULL, argv, envp,
G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,