]> granicus.if.org Git - python/commitdiff
Fix #5162. Allow child spawning from Windows services (via pywin32).
authorbrian.curtin <brian@python.org>
Mon, 11 Apr 2011 22:56:23 +0000 (17:56 -0500)
committerbrian.curtin <brian@python.org>
Mon, 11 Apr 2011 22:56:23 +0000 (17:56 -0500)
Lib/multiprocessing/forking.py

index d2a320845365707011bb221abc48aa308a6f3844..0300a4b8c299e1066f01f784cbbcdf6a0629ae34 100644 (file)
@@ -195,6 +195,7 @@ else:
 
     TERMINATE = 0x10000
     WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False))
+    WINSERVICE = sys.executable.lower().endswith("pythonservice.exe")
 
     exit = win32.ExitProcess
     close = win32.CloseHandle
@@ -204,7 +205,7 @@ else:
     # People embedding Python want to modify it.
     #
 
-    if sys.executable.lower().endswith('pythonservice.exe'):
+    if WINSERVICE:
         _python_exe = os.path.join(sys.exec_prefix, 'python.exe')
     else:
         _python_exe = sys.executable
@@ -394,7 +395,7 @@ else:
         if _logger is not None:
             d['log_level'] = _logger.getEffectiveLevel()
 
-        if not WINEXE:
+        if not WINEXE and not WINSERVICE:
             main_path = getattr(sys.modules['__main__'], '__file__', None)
             if not main_path and sys.argv[0] not in ('', '-c'):
                 main_path = sys.argv[0]