Sfoglia il codice sorgente

grass.py: fix startup in case of missing SHELL var (eg docker) (trunk, https://trac.osgeo.org/grass/changeset/64684 + https://trac.osgeo.org/grass/changeset/64688)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@64692 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 10 anni fa
parent
commit
2de27e8acb
1 ha cambiato i file con 9 aggiunte e 2 eliminazioni
  1. 9 2
      lib/init/grass.py

+ 9 - 2
lib/init/grass.py

@@ -900,10 +900,17 @@ def check_shell():
         os.environ['SHELL'] = "/usr/bin/bash.exe"
         os.environ['OSTYPE'] = "cygwin"
     else:
-        sh = os.path.basename(os.getenv('SHELL'))
+        # in docker the 'SHELL' variable may not be
+        # visible in a Python session
+        try:
+            sh = os.path.basename(os.getenv('SHELL'))
+        except:
+            sh = 'sh'
+            os.environ['SHELL'] = sh
+        
         if windows and sh:
             sh = os.path.splitext(sh)[0]
-
+        
         if sh == "ksh":
             shellname = "Korn Shell"
         elif sh == "csh":