zowe-cli icon indicating copy to clipboard operation
zowe-cli copied to clipboard

CommandResponse never empties stderr and stdout buffers

Open awharn opened this issue 3 years ago • 0 comments

As the name of this issue indicates, the stdout and stderr buffers in CommandResponse are never emptied when data is written to the console. This underlying issue was the cause of the issue fixed in zowe/imperative#573, but more consideration needs to be put into this behavior.

Possible Resolutions and Problems:

  1. Print buffers on write() and reallocate the buffers
    • Prints data that might come from silent command handlers
    • Breaks tests that check buildJsonResponse's stderr and stdout
  2. Implement 1 and don't add anything from a silent command handler to the buffers
    • Again breaks tests that check buildJsonResponse's stderr and stdout to verify the information was silently added to the buffer
    • May hide important stderr information from the end user or automation
  3. Implement new silent stdout and stderr buffers that appear in buildJsonResponse
    • Events will be out of order on output

Other considerations appreciated. However, any change to this low level code could possibly be considered breaking to plugins and extenders, so changes would likely need to be implemented in next

awharn avatar Mar 24 '21 17:03 awharn