# HG changeset patch
# User Edouard Tisserant <edouard.tisserant@gmail.com>
# Date 1658074066 -7200
# Node ID da7b461f54b7416c8584f077d7f511695a19b24b
# Parent  8a9a7d180b93d570811b3cd3d9178c1bacf7c9a9
CLI: Explicitely wait for user interrupt (-k) and flush stdout each line.

diff -r 8a9a7d180b93 -r da7b461f54b7 Beremiz_cli.py
--- a/Beremiz_cli.py	Sun Jul 17 17:49:34 2022 +0200
+++ b/Beremiz_cli.py	Sun Jul 17 18:07:46 2022 +0200
@@ -4,6 +4,7 @@
 import os
 import posixpath
 import sys
+import time
 from functools import wraps
 
 import click
@@ -105,6 +106,11 @@
 
     session.controller.finish()
 
+    if session.keep:
+        click.echo("Press Ctrl+C to quit")
+        while True:
+            time.sleep(1)
+
     return ret
 
 if __name__ == '__main__':
diff -r 8a9a7d180b93 -r da7b461f54b7 CLIController.py
--- a/CLIController.py	Sun Jul 17 17:49:34 2022 +0200
+++ b/CLIController.py	Sun Jul 17 18:07:46 2022 +0200
@@ -22,6 +22,7 @@
             if self.crlfpending:
                 sys.stdout.write("\n")
             sys.stdout.write(s)
+            sys.stdout.flush()
             self.crlfpending = 0
 
     def write_error(self, s):