billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=e188244c720097aa682a28147081ebdc4b924507

commit e188244c720097aa682a28147081ebdc4b924507
Author: Boris Faure <bill...@gmail.com>
Date:   Fri Feb 17 21:57:57 2017 +0100

    pty: fallback to ~ or / when creating new term if current dir is not 
available
    
    Closes T5186
---
 src/bin/termpty.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 30ee96a..9fb7615 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -575,14 +575,34 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const 
char *cd,
    if (!ty->pid)
      {
         char buf[256];
+        int ret;
 
         if (cd)
           {
-             if (chdir(cd) != 0)
+             ret = chdir(cd);
+             if (ret != 0)
                {
                   ERR(_("Could not change current directory to '%s': %s"),
                         cd, strerror(errno));
-                  exit(127);
+                  cd = getenv("HOME");
+                  if (cd)
+                    {
+                       ret = chdir(cd);
+                       if (ret != 0)
+                         {
+                            ERR(_("Could not change current directory to '%s': 
%s"),
+                                cd, strerror(errno));
+                         }
+                    }
+                  if (ret != 0)
+                    {
+                       cd = "/";
+                       if (chdir(cd) != 0)
+                         {
+                            ERR(_("Could not change current directory to '%s': 
%s"),
+                                cd, strerror(errno));
+                         }
+                    }
                }
           }
 

-- 


Reply via email to