So what happens when you run your program > /dev/null
?

For testing I would write a function that reads from an io.Reader and 
writes to an io.Reader.
Write a unit test which uses a bytes.Buffer to catch the output.

On Monday, 9 May 2022 at 04:59:37 UTC+1 Const V wrote:

> I'm using OSX. 
>
> The only reasonI need to redirect is to catch the STOUT output in a string 
> for testing,
> It seems Pipe has limited capacity. May be there is another way.
>
> On Sunday, May 8, 2022 at 8:33:09 PM UTC-7 Amnon wrote:
>
>>
>> Why don't you try redirecting stdout to /dev/null and see how your 
>> program behaves.
>>
>> Also, which OS are you using?
>>
>> On Sun, May 8, 2022 at 11:36 PM Const V <ths...@gmail.com> wrote:
>>
>>> reading 1 line '\n' delimited 100MB file 
>>> r1 := bufio.NewReader(file)
>>> s := ReadWithReadLine(r1)
>>> InputProcessing(strings.NewReader(s), os.Stdout)
>>>
>>> in InputProcessing"
>>> w.Write([]byte(s)) -> waiting forever
>>> w.Write([]byte(s)[:100]) -> working
>>> ---
>>> func InputProcessing(r io.Reader, w io.Writer) {
>>> find := "error"
>>> /////////////////////////////////
>>> s := ReadWithReadLine(r)
>>> if strings.Contains(s, find) {
>>> w.Write([]byte(s)[:100])
>>> w.Write([]byte("\n"))
>>> } else {
>>> w.Write([]byte(" \n"))
>>> }
>>> }
>>> ---
>>> On Sunday, May 8, 2022 at 3:21:52 PM UTC-7 Amnon wrote:
>>>
>>>> On Sun, May 8, 2022 at 10:41 PM Const V <ths...@gmail.com> wrote:
>>>>
>>>>> write to stdout is not working for MB long strings
>>>>>
>>>>>>
>>>>>>
>>>> That is very surprising indeed.
>>>> How do you reach the conclusion?
>>>> How can we replicate that failure?
>>>>
>>> -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "golang-nuts" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/golang-nuts/IUMIxWx9aLk/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> golang-nuts...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/golang-nuts/b1259910-58ca-4a57-bb05-1dde2fc73443n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/golang-nuts/b1259910-58ca-4a57-bb05-1dde2fc73443n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4ffe8196-d9c5-42ad-a713-ae621ff68efan%40googlegroups.com.

Reply via email to