MCPcopy
hub / github.com/Xyntax/POC-T / dataToStdout

Function dataToStdout

lib/core/common.py:81–103  ·  view source on GitHub ↗

Writes text to the stdout (console) stream

(data, bold=False)

Source from the content-addressed store, hash-verified

79
80
81def dataToStdout(data, bold=False):
82 """
83 Writes text to the stdout (console) stream
84 """
85 if conf.SCREEN_OUTPUT:
86 if conf.ENGINE is ENGINE_MODE_STATUS.THREAD:
87 logging._acquireLock()
88
89 if isinstance(data, unicode):
90 message = stdoutencode(data)
91 else:
92 message = data
93
94 sys.stdout.write(setColor(message, bold))
95
96 try:
97 sys.stdout.flush()
98 except IOError:
99 pass
100
101 if conf.ENGINE is ENGINE_MODE_STATUS.THREAD:
102 logging._releaseLock()
103 return
104
105
106def setColor(message, bold=False):

Callers 4

runFunction · 0.90
printMessageFunction · 0.90
printProgressFunction · 0.90
bannerFunction · 0.85

Calls 3

stdoutencodeFunction · 0.90
setColorFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected