Flush stderr on write (#248)

This commit is contained in:
Fangjun Kuang
2023-08-09 15:33:01 +08:00
committed by GitHub
parent 46062bb697
commit 92bfee0424
2 changed files with 4 additions and 1 deletions

View File

@@ -142,6 +142,7 @@ as the device_name.
[](auto c) { return std::tolower(c); });
display.Print(segment_index, text);
fflush(stderr);
}
if (is_endpoint) {

View File

@@ -139,12 +139,14 @@ for a list of pre-trained models to download.
std::transform(text.begin(), text.end(), text.begin(),
[](auto c) { return std::tolower(c); });
display.Print(segment_index, text);
fprintf(stderr, "\r%d: %s", segment_index, text.c_str());
fflush(stderr);
}
if (is_endpoint) {
if (!text.empty()) {
++segment_index;
fprintf(stderr, "\n");
}
recognizer.Reset(s.get());