Browse Source

wxGUI: fix GuiModuleMain on Windows, os.fork() is supported only on Unix

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57389 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 years ago
parent
commit
7e0539f56d
1 changed files with 12 additions and 5 deletions
  1. 12 5
      gui/wxpython/core/utils.py

+ 12 - 5
gui/wxpython/core/utils.py

@@ -1047,11 +1047,18 @@ def GetGEventAttribsForHandler(method, event):
 
 def GuiModuleMain(mainfn):
     """!Main function for g.gui.* modules
-
+    
+    Note: os.fork() is supported only on Unix platforms
+    
+    @todo: Replace os.fork() by multiprocessing (?)
+    
     @param module's main function
     """
-    # launch GUI in the background
-    child_pid = os.fork()
-    if child_pid == 0:
+    if sys.platform != 'win32':
+        # launch GUI in the background
+        child_pid = os.fork()
+        if child_pid == 0:
+            mainfn()
+        os._exit(0)
+    else:
         mainfn()
-    os._exit(0)