From 4e40d7059985e968eb547581865b603e3d7f78d3 Mon Sep 17 00:00:00 2001 From: imarom Date: Mon, 25 Jul 2016 12:06:51 +0300 Subject: TUI - stdout close/reopen issues --- scripts/automation/trex_control_plane/stl/console/trex_tui.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl/console/trex_tui.py') diff --git a/scripts/automation/trex_control_plane/stl/console/trex_tui.py b/scripts/automation/trex_control_plane/stl/console/trex_tui.py index 2e26fdfc..81ba335c 100644 --- a/scripts/automation/trex_control_plane/stl/console/trex_tui.py +++ b/scripts/automation/trex_control_plane/stl/console/trex_tui.py @@ -619,19 +619,15 @@ class AsyncKeys: termios.tcsetattr(sys.stdin, termios.TCSADRAIN, new_settings) # huge buffer - no print without flush - tmp_fd = os.dup(sys.stdout.fileno()) - sys.stdout.close() - sys.stdout = os.fdopen(tmp_fd, 'w', 80 * 25 * 2) - + sys.stdout = open('/dev/stdout', 'w', TrexTUI.MIN_COLS * TrexTUI.MIN_COLS * 2) return self def __exit__ (self, type, value, traceback): termios.tcsetattr(sys.stdin, termios.TCSADRAIN, self.old_settings) # restore sys.stdout - tmp_fd = os.dup(sys.stdout.fileno()) sys.stdout.close() - sys.stdout = os.fdopen(tmp_fd, 'w', -1) + sys.stdout = sys.__stdout__ def is_legend_mode (self): -- cgit 1.2.3-korg