Closed cynepco3hahue closed 5 years ago
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
:memo: Please visit https://cla.developers.google.com/ to sign.
Once you've signed (or fixed any issues), please reply here (e.g. I signed it!
) and we'll verify it.
I signed it!
CLAs look good, thanks!
@skalle Give me know if I missed something.
Hey @cynepco3hahue.
We probably don't want to change the Send command itself, the API is pretty set.
There's a few options to handle adding a timeout to Send.
What about combining 1 & 2 , add an option to set the default Send timeout , this would apply to the "old" version of Send too.. If not set it could be infinity as it is today. On top of that add another SendWithTimeout method where you can set the desired timeout.
On some more thinking ..
With Send being pretty much only a Write, I don't think the need for a timeout in the method would be used much. Having an option to set a timeout would probably be enough. Option 2 that is.
@skalle Thanks for detailed explanation, I refactored the code change to use option 2, maybe do you have an idea how can I test it with current a SpawnFake
method?
Sorry for the delay here, just not enough cycles atm.
PR looks good , just need a test in there. As often happens the tests might be harder than the added feature. Should be fairly straight forward to setup a SpawnGeneric where the writer function , instead of the usual `go io.Copy(..pipes..) would be a writer function that delays the write for some specified time..
Thx. contributing and happy to help out if you get stuck with the tests.
@skalle Sure no problem, we all have a lot of tasks :smile: I added unittest, can you please review again?
You added that in faster than I expected .. Some nits in there, with that sorted I'll merge it in..
Thx!
Merged in .. Thx. a lot for making this project better!
@skalle Great, thanks for your help with review:)
Before this PR,
Send
stuck forever if the spawned process does not ready to get input.Fixes #30