From 26ff62a5941db781920b1ef9ff72bfa21d11aae0 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 24 Feb 2022 07:46:02 -0500 Subject: [PATCH] hook: fix eof handling --- src/villas-hook.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/villas-hook.cpp b/src/villas-hook.cpp index 0483695bc..d44ead363 100644 --- a/src/villas-hook.cpp +++ b/src/villas-hook.cpp @@ -261,18 +261,14 @@ check: if (optarg == endptr) h->prepare(input->getSignals()); h->start(); - while (!stop) { + while (!stop && !feof(stdin)) { ret = sample_alloc_many(&p, smps, cnt); if (ret != cnt) throw RuntimeError("Failed to allocate {} smps from pool", cnt); recv = input->scan(stdin, smps, cnt); - if (recv < 0) { - if (feof(stdin)) - break; - + if (recv < 0) throw RuntimeError("Failed to read from stdin"); - } timespec now = time_now();