Skip to content

Commit c32e06f

Browse files
author
Francesco Faraone
committed
LITE-27149 use unbuffered stdout stream for reach console
1 parent e73a5d5 commit c32e06f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

connect/cli/ccli.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
# This file is part of the Ingram Micro Cloud Blue Connect connect-cli.
44
# Copyright (c) 2019-2021 Ingram Micro. All Rights Reserved.
5+
import io
6+
import sys
7+
58
import click
69

710
from connect.cli.core.base import cli
@@ -10,6 +13,7 @@
1013

1114

1215
def main():
16+
_set_stdout_unbuffered()
1317
_ignore_openpyxl_warnings()
1418
try:
1519
import uvloop
@@ -44,5 +48,10 @@ def _ignore_openpyxl_warnings():
4448
warnings.filterwarnings('ignore', category=UserWarning, module='openpyxl.worksheet._reader')
4549

4650

51+
def _set_stdout_unbuffered(): # pragma: no cover
52+
if 'pytest' not in sys.modules:
53+
sys.stdout = io.TextIOWrapper(open(sys.stdout.fileno(), 'wb', 0), write_through=True)
54+
55+
4756
if __name__ == '__main__':
4857
main() # pragma: no cover

0 commit comments

Comments
 (0)