mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-24 14:13:43 +00:00
Add error handling for screen console function.
This commit is contained in:
parent
efbbb656a1
commit
27df4e20da
1 changed files with 3 additions and 1 deletions
|
|
@ -32,7 +32,7 @@ STDOUT = -11
|
||||||
STDERR = -12
|
STDERR = -12
|
||||||
|
|
||||||
from ctypes import (windll, byref, Structure, c_char, c_short, c_uint32,
|
from ctypes import (windll, byref, Structure, c_char, c_short, c_uint32,
|
||||||
c_ushort, ArgumentError)
|
c_ushort, ArgumentError, WinError)
|
||||||
|
|
||||||
handles = {
|
handles = {
|
||||||
STDOUT: windll.kernel32.GetStdHandle(STDOUT),
|
STDOUT: windll.kernel32.GetStdHandle(STDOUT),
|
||||||
|
|
@ -85,6 +85,8 @@ def GetConsoleScreenBufferInfo(stream_id=STDOUT):
|
||||||
csbi = CONSOLE_SCREEN_BUFFER_INFO()
|
csbi = CONSOLE_SCREEN_BUFFER_INFO()
|
||||||
success = windll.kernel32.GetConsoleScreenBufferInfo(
|
success = windll.kernel32.GetConsoleScreenBufferInfo(
|
||||||
handle, byref(csbi))
|
handle, byref(csbi))
|
||||||
|
if not success:
|
||||||
|
raise WinError()
|
||||||
return csbi
|
return csbi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue