Closed yageek closed 7 years ago
Hi @yageek! Thanks for this PR! Could you please outline what the target usecase is for this change - that is - why is it better than the current implementation? 🙂
The thing I wanted to add is still not working after some tests (last bullet) :(. The elements I wanted to improve:
Data
and the termination status when an ShellOutError
is thrown.Process
, I would like to stream them directly out instead of waiting the completion to finish. In a CI script, it could be useful to stream the received elements as long as the compilation is going forward.I am investigating a little further about how to stream the output correctly. Is there some slack channel to discuss about improvement and features but the way?
After taking a look more closely, this is working in deed. I have a created a compilation script that behaves like travis and I am able to see the output as it is streamed. This behaviour could be used also for marathon run
.
@yageek Thanks again for this, I love the idea - it's going to make a big improvement to Marathon, since you don't have to wait for the full output 👍 I put some comments inline, and also some tests are needed before this can be merged in 🙂
I have updated the API and added the missing tests. The only question remaining is to allow/disallow access to the raw Data
in case of error.
I renamed the arguments. Your proposition made more sens. About the error, according to me, we should give the opportunity to have access to the data. Here when we are converting to String
we assume we are using an utf8
encoding. May be some programs outputs text in a different encoding. Providing an access to the internal buffers will allow any transformation.
Use a different strategy to retrieve the content of STDOUT and STDERR. The
ShellOutError
structure has been changed but the API remains the same. The structure now contains both STDOUT and STDERR asData
and we can retrieve the equivalentString
using the previous propertiesmessage
andoutput
. From my memories, any non 0terminationStatus
should be considered as an error. This also allows to introduce a parameterprintOutput
which will output the received data toSTDOUT
andSTDERR
.