cmd icon indicating copy to clipboard operation
cmd copied to clipboard

ErrLineBufferOverflow error when a command uses return (\r) to overwrite previous output line

Open bjohnsonAPF opened this issue 4 years ago • 1 comments

Some commands use a return character at the end of each line in order to overwrite the previous output line with new data. This is often used to show progress of the running command. An example is the dc3dd command. This command outputs the progress of the command to one line that consistently gets overwritten with the new progress stats. If a long running command does this the output will continually be saved to the buffer and not passed to the go channel in the Write function of OutputStream because this function only checks for \n or \r\n at the end of a line. Because a command like this will never have a \n at the end of an output line the buffer will overflow every time the command is run.

bjohnsonAPF avatar Sep 11 '21 14:09 bjohnsonAPF

https://github.com/shicheng0829/cmd

I met with the problem same as you. This repo may be helpful. I change the delimiter to \n or \r. Ignore \r\n Because \r\n only useful in Windows environment.

shicheng0829 avatar Feb 09 '23 09:02 shicheng0829