jeking3/grunt-shell-spawn

Option: Disable standard output buffering

Closed this issue · 1 comments

My use case for grunt-shell-spawn is to pipe the output of a command to a file. To do this, I'd like to:

  • Create a writeable stream to the output file.
  • Write to it using the stdout callback.
  • Close the stream when callback is triggered.

However, this command produces >200KB of output, which is greater than BUFF_LENGTH: https://github.com/cri5ti/grunt-shell-spawn/blob/master/tasks/shell.js#L64

As a result, this task overruns the buffer, which causes a runtime error.

I would like an option to disable standard output buffering so that I can assign a callback to the callback property without receiving this runtime error.

I can write a PR for this usecase if need be; I believe all I'll need to do is perform an extra OR here: https://github.com/cri5ti/grunt-shell-spawn/blob/master/tasks/shell.js#L64, and add a conditional around these two lines: https://github.com/cri5ti/grunt-shell-spawn/blob/master/tasks/shell.js#L117

Nevermind. I just tested it out, and it actually just truncates to 200KB in practice.