本文整理汇总了Python中win32con.CTRL_C_EVENT属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.CTRL_C_EVENT属性的具体用法?Python win32con.CTRL_C_EVENT怎么用?Python win32con.CTRL_C_EVENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类win32con
的用法示例。
在下文中一共展示了win32con.CTRL_C_EVENT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import CTRL_C_EVENT [as 别名]
def handle(self, event):
"""Handle console control events (like Ctrl-C)."""
if event in (win32con.CTRL_C_EVENT, win32con.CTRL_LOGOFF_EVENT,
win32con.CTRL_BREAK_EVENT, win32con.CTRL_SHUTDOWN_EVENT,
win32con.CTRL_CLOSE_EVENT):
self.bus.log('Console event %s: shutting down bus' % event)
# Remove self immediately so repeated Ctrl-C doesn't re-call it.
try:
self.stop()
except ValueError:
pass
self.bus.exit()
# 'First to return True stops the calls'
return 1
return 0
示例2: handle
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import CTRL_C_EVENT [as 别名]
def handle(self, event):
"""Handle console control events (like Ctrl-C)."""
if event in (win32con.CTRL_C_EVENT, win32con.CTRL_LOGOFF_EVENT,
win32con.CTRL_BREAK_EVENT, win32con.CTRL_SHUTDOWN_EVENT,
win32con.CTRL_CLOSE_EVENT):
self.bus.log('Console event %s: shutting down bus' % event)
# Remove self immediately so repeated Ctrl-C doesn't re-call it.
try:
self.stop()
except ValueError:
pass
self.bus.exit()
# 'First to return True stops the calls'
return 1
return 0
示例3: _DebugCtrlHandler
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import CTRL_C_EVENT [as 别名]
def _DebugCtrlHandler(evt):
if evt in (win32con.CTRL_C_EVENT, win32con.CTRL_BREAK_EVENT):
assert g_debugService
print "Stopping debug service."
g_debugService.SvcStop()
return True
return False
示例4: __close_internal_windows
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import CTRL_C_EVENT [as 别名]
def __close_internal_windows(self):
self.log.debug("Sending CTRL_C_EVENT to chromium")
win32api.GenerateConsoleCtrlEvent(win32con.CTRL_C_EVENT, self.cr_proc.pid)
self.cr_proc.send_signal(signal.CTRL_BREAK_EVENT)
self.cr_proc.send_signal(signal.CTRL_C_EVENT)
self.cr_proc.send_signal(1)
self.log.debug("Sent")
try:
self.check_process_ded() # Needed to flush the communcation pipes, sometimes
# I can't get this to fucking ever work,
# so just skip and go straight to termination.
# self.log.debug("Waiting for chromium to exit")
# try:
# self.cr_proc.wait(timeout=5)
# except subprocess.TimeoutExpired:
# pass
try:
self.cr_proc.terminate()
except ProcessLookupError:
self.log.debug("Process exited normally, no need to terminate.")
self.check_process_ded() # Processes may dangle until the pipes are closed.
try:
self.cr_proc.kill()
except ProcessLookupError:
self.log.debug("Process exited normally, no need to terminate.")
self.check_process_ded() # Processes may dangle until the pipes are closed.
except cr_exceptions.ChromeDiedError:
self.log.debug("ChromeDiedError while polling. Ignoring due to shutdown.")
# Considering we're /trying/ to kill chrome, it
# dying is OK.
self.log.debug("Pid: %s, Return code: %s", self.cr_proc.pid, self.cr_proc.returncode)
self.log.debug("Chromium closed!")