[Cryptech-Commits] [sw/libhal] 01/02: Add console log support to muxd.
git at cryptech.is
git at cryptech.is
Sat Apr 15 22:35:52 UTC 2017
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch ksng
in repository sw/libhal.
commit 5357c6d04432c25945563bd71e74ebecb8290276
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sat Apr 15 17:53:23 2017 -0400
Add console log support to muxd.
---
cryptech_muxd | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/cryptech_muxd b/cryptech_muxd
index dc20b62..c1cdf22 100755
--- a/cryptech_muxd
+++ b/cryptech_muxd
@@ -217,9 +217,10 @@ class CTYIOStream(SerialIOStream):
Tornado IOStream for a serial console channel.
"""
- def __init__(self, device):
+ def __init__(self, device, console_log = None):
super(CTYIOStream, self).__init__(device)
self.attached_cty = None
+ self.console_log = console_log
@tornado.gen.coroutine
def cty_output_loop(self):
@@ -232,6 +233,11 @@ class CTYIOStream(SerialIOStream):
self.attached_cty.close()
return
try:
+ if self.console_log is not None:
+ self.console_log.write(buffer)
+ except:
+ pass
+ try:
if self.attached_cty is not None:
yield self.attached_cty.write(buffer)
except tornado.iostream.StreamClosedError:
@@ -359,6 +365,10 @@ def main():
parser.add_argument("-l", "--log-file",
help = "log to file instead of stderr")
+ parser.add_argument("-L", "--console-log",
+ type = argparse.FileType("w"),
+ help = "log console output to file")
+
parser.add_argument("-p", "--probe",
nargs = "*",
metavar = "DEVICE",
@@ -409,7 +419,7 @@ def main():
if args.cty_device is None:
logger.warn("No CTY device found")
else:
- cty_stream = CTYIOStream(device = args.cty_device)
+ cty_stream = CTYIOStream(device = args.cty_device, console_log = args.console_log)
cty_server = CTYServer(cty_stream, args.cty_socket)
futures.append(cty_stream.cty_output_loop())
More information about the Commits
mailing list