# include <sys/wait.h>
#endif
-#define DEFAULT_PAGER "less"
+
+/* "R" : support color
+ * "X" : do not clear the screen when leaving the pager
+ * "F" : skip the pager if content fit into the screen
+ */
+#define DEFAULT_LESS_OPTS "RXF"
gboolean colored_output = TRUE;
+#ifdef G_OS_UNIX
+static const gchar DEFAULT_PAGER[] = "less";
GPid child_pid = -1;
+#endif
GMainLoop *loop = NULL;
/* Console colors */
g_type_name (param->value_type), RESET_COLOR);
if (param->value_type == GST_TYPE_STRUCTURE) {
const GstStructure *s = gst_value_get_structure (&value);
- if (s)
+ if (s) {
+ g_print ("\n");
gst_structure_foreach (s, print_field,
(gpointer) " ");
+ }
}
} else if (G_IS_PARAM_SPEC_POINTER (param)) {
if (param->value_type != G_TYPE_POINTER) {
argv = g_strsplit (pager, " ", 0);
- /* "R" : support color
- * "X" : Do not init/deinit terminal. Uncleared "inspected output" on terminal
- * seems to be more useful
- */
envp = g_get_environ ();
- envp = g_environ_setenv (envp, "LESS", "-RX", TRUE);
+ envp = g_environ_setenv (envp, "LESS", DEFAULT_LESS_OPTS, TRUE);
if (!g_spawn_async_with_pipes (NULL, argv, envp,
G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
NULL, NULL, &child_pid, &stdin_fd,
/* pass null stdout/stderr to inherit our fds */
NULL, NULL, &error)) {
- g_warning ("g_spawn_async_with_pipes() failed: %s\n",
- GST_STR_NULL (error->message));
+ if (pager != DEFAULT_PAGER) {
+ g_warning ("g_spawn_async_with_pipes() failed: %s\n",
+ GST_STR_NULL (error->message));
+ }
g_strfreev (argv);
g_strfreev (envp);
g_clear_error (&error);