[gnome-builder] terminal: strip surrounding whitespace from shell path



commit d2b9169df3c7e44b2e416274fadc222ec0137eda
Author: Christian Hergert <chergert redhat com>
Date:   Fri Sep 16 12:44:18 2016 -0700

    terminal: strip surrounding whitespace from shell path
    
    There is a good chance we'll get a trailing \n, so strip that from the
    shell path before using it for command execution.

 plugins/terminal/gb-terminal-view.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/plugins/terminal/gb-terminal-view.c b/plugins/terminal/gb-terminal-view.c
index feedebb..131a236 100644
--- a/plugins/terminal/gb-terminal-view.c
+++ b/plugins/terminal/gb-terminal-view.c
@@ -110,8 +110,12 @@ gb_terminal_view_discover_shell (GCancellable  *cancellable,
   if (!ide_subprocess_communicate_utf8 (subprocess, NULL, cancellable, &stdout_buf, NULL, error))
     return NULL;
 
-  if (!ide_str_empty0 (stdout_buf) && stdout_buf[0] == '/')
-    cached_shell = g_steal_pointer (&stdout_buf);
+  if (stdout_buf != NULL)
+    {
+      g_strstrip (stdout_buf);
+      if (stdout_buf[0] == '/')
+        cached_shell = g_steal_pointer (&stdout_buf);
+    }
 
   return cached_shell;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]