[go-nuts] Re: Taking possible EOF as input

2018-09-04 Thread peterGo
Hunter, When you write input.Scan() you are discarding important information, the return value. $ go doc bufio.scan func (s *Scanner) Scan() bool With the return value, you have an easy test for io.EOF. For example, scan := input.Scan() eof := !scan && input.Err() == nil . Peter On Tuesday,

Re: [go-nuts] Re: Taking possible EOF as input

2018-09-04 Thread Jan Mercl
On Tue, Sep 4, 2018 at 5:28 PM Hunter Breathat wrote: > I only had stated that bufio.Scan() doesn't return io.EOF as the doc stats that it Err returns nil. Which is fine but hard to check for. But from what I've seen the functionality that im looking for would need to check for the SIG.KILL/EOF

[go-nuts] Re: Taking possible EOF as input

2018-09-04 Thread Hunter Breathat
I only had stated that bufio.Scan() doesn't return io.EOF as the doc stats that it Err returns nil. Which is fine but hard to check for. But from what I've seen the functionality that im looking for would need to check for the SIG.KILL/EOF on input. Now whether or not i shoudlgo and alter th

[go-nuts] Re: Taking possible EOF as input

2018-09-04 Thread Hunter Breathat
On Monday, 3 September 2018 12:49:12 UTC-4, Hunter Breathat wrote: > > Hey, so I'm currently trying to create a custom shell. > > I am currently trying to implement the EOF exit (^D). Currently, I am able > to use exit as input and a variety of other > commands, platform-specific; anything, not

[go-nuts] Re: Taking possible EOF as input

2018-09-04 Thread peterGo
Hunter, Your main.go file is 171 lines of dense code. If you reduced your issue to a small, working piece of code, people would be more likely help you. You say "bufio.Scan() doesn't return io.EOF." Why? $ go doc bufio.scanner type Scanner struct { } Scanning stops unrecoverably at EOF, th