@Dariusz said in QProcess not printing "live update" from cmd:
sftp sends messges like
But (so far as I can see) you know it does that only when output is attached to a terminal/console. Which their code may be testing for, and not sending if not.
Because there is no \n, the qt does not trigger any signals. Not byteavailable or anything really as far as I can tell.
The presence or absence of \n will not itself affect whether Qt/QProcess sees or receives bytes. It might be an indication that it is not being flushed immediately, but that is a different matter.
I take when we self.process.setProcessChannelMode(QProcess.ForwardedChannels) he then get console somehow?
I believe that attaches the QProcess's output to the output of the Qt program, which is a console/terminal. Which as I say may be why in that case, and only that case, you see the output. But then you won't be able to "capture" it.
Can you link me to post/text? I'm blind :- (
Principal among these was
Try running your sftp from a Command Prompt but with all its output redirected to a file. When it has finished what is in that file, any "status messages"?
You should test something like:
sftp < file_of_input_commands > some_file
If you can also redirect Windows/DOS/cmd stderr that would be even better. Like under Linux it would be
sftp < file_of_input_commands > some_file 2>&1
but I can't recall whether/how you can do that 2>&1-type thing with Windows. Test without that anyway.
The point here is that output should not be left to go to console. This is close to simulating what is going on when you have another program --- Qt or not --- running a sub-process with redirection. I have a hunch this will show that in this situation you do not get the "update" messages, because sftp program detects the output redirection and does not issue them in this case.....