On Sunday, 5 March 2023 17:11:13 PST Scott Bloom wrote:
> I have an external executable (mkvalidator from 
> https://www.matroska.org/downloads/mkvalidator.html
> 
> It never flushes the output, and it uses linefeed without carriage 
> returns to overwrite existing text on the output.

You've described the standard for Unix processes. There's no carriage return 
and stdout is fully buffered when not connected to a terminal.

> The problem is, when I run it via QProcess (on windows, Qt 5.15.10), I 
> get zero output until the process ends.  As if it was buffered, and 
> the output was finally flushed
> 
> When running from the command line, I do get output continuously 
> during the processing.
> 
> I setup a timer to waitForRead, didn't do anything. I cant seem to 
> force the QProcess to read all stdout or stderror info.

You don't need a timer on waitForRead because you have the readyRead() signal.

Anyway, the problem is that your process is not writing. It's buffering its 
output until later. This is not a QProcess problem; you must force the child 
process to write.

Many programs that do this type of interaction have a command-line option to 
switch back to line-buffered. For those that don't, you can use the /usr/bin/ 
stdbuf tool to change the buffering semantics, but I don't know how it works, 
just that it does on Linux, so it may not on Windows.

Since you're on Windows and this application is not part of Windows itself, it 
stands to reason you're compiling it yourself and distributing with your 
application. So just modify it to be line-buffered.

--
=================
Unfortunately no, I am not building it myself.  Its built by a third party and 
distributed via mkvtoolsnix distro world on windows.

Ill take a look at try to find a switch, but its unlikely they have it

Thanks
Scott
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to