[GRASS-dev] [GRASS GIS] #3295: GRASS GIS fails to start without terminal

GRASS GIS trac at osgeo.org
Mon Feb 20 14:10:20 PST 2017


#3295: GRASS GIS fails to start without terminal
-------------------------+-------------------------------------------------
  Reporter:  wenzeslaus  |      Owner:  grass-dev@…
      Type:  defect      |     Status:  new
  Priority:  normal      |  Milestone:  7.4.0
 Component:  Startup     |    Version:  unspecified
Resolution:              |   Keywords:  gisset, wxGUI, init, grass.py,
       CPU:              |  nohup, terminal, shell, GUI, CLI, exec, g.gui
  Unspecified            |   Platform:  Linux
-------------------------+-------------------------------------------------

Comment (by wenzeslaus):

 From the nohup case I get the following in the output (as expected, I
 suppose):

 {{{
 /bin/bash: error reading input file: Bad file descriptor
 WARNING: Failed to start shell '/bin/bash'
 }}}

 With the following patch, nohup case actually runs.

 {{{
 #!diff
 Index: grass.py
 ===================================================================
 --- grass.py    (revision 70649)
 +++ grass.py    (working copy)
 @@ -1386,7 +1386,8 @@

      # Check for gui interface
      if grass_gui == "wxpython":
 -        Popen([os.getenv('GRASS_PYTHON'), wxpath("wxgui.py")])
 +        return Popen([os.getenv('GRASS_PYTHON'), wxpath("wxgui.py")])
 +    return None


  def close_gui():
 @@ -1961,7 +1962,7 @@
                                              mapset_settings.location)

          # start GUI and register shell PID in rc file
 -        start_gui(grass_gui)
 +        gui_process = start_gui(grass_gui)
          kv = read_gisrc(gisrc)
          kv['PID'] = str(shell_process.pid)
          write_gisrc(kv, gisrc)
 @@ -1968,6 +1969,13 @@
          exit_val = shell_process.wait()
          if exit_val != 0:
              warning(_("Failed to start shell '%s'") % os.getenv('SHELL'))
 +            # remove shell PID because GUI should not kill it
 +            kv = read_gisrc(gisrc)
 +            del kv['PID']
 +            write_gisrc(kv, gisrc)
 +            # if there is no shell but GUI is set, wait for that
 +            if grass_gui != "text":
 +                gui_process.wait()

          # close GUI if running
          close_gui()
 }}}

 However, with Ctrl+F2 I still get the same behavior. I don't see anything
 helpful in the `sudo strace -p... -s9999 -e write` output (using PID of
 `grass` and `gis_set.py`).

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3295#comment:1>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list