Add Utils support for Windows console
This commit is contained in:
parent
f15a87f92b
commit
ea8cc8e666
@ -37,6 +37,8 @@ def isMacOS():
|
|||||||
def isBSD():
|
def isBSD():
|
||||||
return constants.OS_BSD in sys.platform or sys.platform.startswith(constants.OS_DRAGONFLY)
|
return constants.OS_BSD in sys.platform or sys.platform.startswith(constants.OS_DRAGONFLY)
|
||||||
|
|
||||||
|
def isWindowsConsole():
|
||||||
|
return os.path.basename(sys.executable) == "SyncplayConsole.exe"
|
||||||
|
|
||||||
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
|
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
|
||||||
"""Retry calling the decorated function using an exponential backoff.
|
"""Retry calling the decorated function using an exponential backoff.
|
||||||
@ -225,6 +227,28 @@ def blackholeStdoutForFrozenWindow():
|
|||||||
sys.stdout = Blackhole()
|
sys.stdout = Blackhole()
|
||||||
del Blackhole
|
del Blackhole
|
||||||
|
|
||||||
|
elif getattr(sys, 'frozen', '') == "console_exe":
|
||||||
|
class Blackhole(object):
|
||||||
|
softspace = 0
|
||||||
|
|
||||||
|
def write(self, text):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def flush(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Stderr(object):
|
||||||
|
softspace = 0
|
||||||
|
_file = None
|
||||||
|
_error = None
|
||||||
|
|
||||||
|
def flush(self):
|
||||||
|
if self._file is not None:
|
||||||
|
self._file.flush()
|
||||||
|
|
||||||
|
sys.stderr = Blackhole()
|
||||||
|
del Blackhole
|
||||||
|
|
||||||
|
|
||||||
def truncateText(unicodeText, maxLength):
|
def truncateText(unicodeText, maxLength):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user