Show More
@@ -613,6 +613,7 b' def service(opts, parentfn=None, initfn=' | |||||
613 | except AttributeError: |
|
613 | except AttributeError: | |
614 | pass |
|
614 | pass | |
615 | os.unlink(lockpath) |
|
615 | os.unlink(lockpath) | |
|
616 | util.hidewindow() | |||
616 | sys.stdout.flush() |
|
617 | sys.stdout.flush() | |
617 | sys.stderr.flush() |
|
618 | sys.stderr.flush() | |
618 |
|
619 |
@@ -529,6 +529,14 b' else:' | |||||
529 | def lookup_reg(key, name=None, scope=None): |
|
529 | def lookup_reg(key, name=None, scope=None): | |
530 | return None |
|
530 | return None | |
531 |
|
531 | |||
|
532 | def hidewindow(): | |||
|
533 | """Hide current shell window. | |||
|
534 | ||||
|
535 | Used to hide the window opened when starting asynchronous | |||
|
536 | child process under Windows, unneeded on other systems. | |||
|
537 | """ | |||
|
538 | pass | |||
|
539 | ||||
532 | if os.name == 'nt': |
|
540 | if os.name == 'nt': | |
533 | from windows import * |
|
541 | from windows import * | |
534 | else: |
|
542 | else: |
@@ -16,7 +16,7 b' used.' | |||||
16 | import win32api |
|
16 | import win32api | |
17 |
|
17 | |||
18 | import errno, os, sys, pywintypes, win32con, win32file, win32process |
|
18 | import errno, os, sys, pywintypes, win32con, win32file, win32process | |
19 | import winerror |
|
19 | import winerror, win32gui | |
20 | import osutil, encoding |
|
20 | import osutil, encoding | |
21 | from win32com.shell import shell, shellcon |
|
21 | from win32com.shell import shell, shellcon | |
22 |
|
22 | |||
@@ -172,3 +172,12 b' def set_signal_handler_win32():' | |||||
172 | win32process.ExitProcess(1) |
|
172 | win32process.ExitProcess(1) | |
173 | win32api.SetConsoleCtrlHandler(handler) |
|
173 | win32api.SetConsoleCtrlHandler(handler) | |
174 |
|
174 | |||
|
175 | def hidewindow(): | |||
|
176 | def callback(*args, **kwargs): | |||
|
177 | hwnd, pid = args | |||
|
178 | wpid = win32process.GetWindowThreadProcessId(hwnd)[1] | |||
|
179 | if pid == wpid: | |||
|
180 | win32gui.ShowWindow(hwnd, win32con.SW_HIDE) | |||
|
181 | ||||
|
182 | pid = win32process.GetCurrentProcessId() | |||
|
183 | win32gui.EnumWindows(callback, pid) |
General Comments 0
You need to be logged in to leave comments.
Login now