summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/sidparse.ml5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/sidparse.ml b/util/sidparse.ml
index 8027692..0440751 100644
--- a/util/sidparse.ml
+++ b/util/sidparse.ml
@@ -1,5 +1,7 @@
(* SPDX-License-Identifier: LGPL-3.0-only WITH OCaml-LGPL-linking-exception *)
+let interactive = Unix.(isatty stdin)
+
let err q v =
match q, v with
| true, _ -> Printf.ifprintf stdout
@@ -61,6 +63,7 @@ let traverse q v next =
| `Done s -> begin
if n = 0 then header q v;
emit q v s;
+ if interactive then flush_all ();
aux (n + 1) ne
end
end
@@ -71,7 +74,7 @@ let sidparse validate quiet args =
let next =
match args with
| [] -> begin
- if Unix.(isatty stdin) then
+ if interactive then
err quiet validate "reading input from stdin\n%!";
from_stdin
end