CommandResponse.console.log buffering to mStdout may cause the node process to fail if it exceeds the heap size limit #1943
Labels
bug
Something isn't working
priority-medium
Not functioning - next quarter if capacity permits
severity-medium
Bug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex.
The
CommandResponse.console.log
function...https://github.com/zowe/imperative/blob/741f24f7246028879317dbd9590b91d7efbdef39/packages/cmd/src/response/CommandResponse.ts#L537-L547
Calls
writeAndBufferStdout
https://github.com/zowe/imperative/blob/741f24f7246028879317dbd9590b91d7efbdef39/packages/cmd/src/response/CommandResponse.ts#L914-L919
Instead of buffering the data, we could Stream it! For example:
The problem with this solution is that streaming is an
async
operation. In order to guarantee that the data is not piped or printed out of order, the streaming operation has to bepromisify
-ed.This means that in order for you to produce output to the terminal, you need to
await response.console.log(data)
, which forces the function that calls this to also beasync
(and also needs to beawait
-ed).The text was updated successfully, but these errors were encountered: