When a process writes to stderr, the output goes to a buffer of a fixed size. If the buffer is full, the process is blocked until there is no space left in the buffer for the remaining output. Therefore, if the buffer is not empty, the process will freeze.
Also, if something goes wrong with the process that you would like to know about, the error stream may contain actual useful information.
Some suggestions:
- The naming of the string ch seems misleading, since ch is commonly used for characters.
- I like to put code that is read from stderr in a dedicated workflow. Thus, switching between reading the input stream and the error stream occurs automatically without my permission.
source share