mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	fix(readline): check stdin error properly
This commit is contained in:
		
							parent
							
								
									bee8d6e9e6
								
							
						
					
					
						commit
						b83c09a2b3
					
				| @ -2,6 +2,7 @@ package readline | ||||
| 
 | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| 	"regexp" | ||||
| @ -78,9 +79,7 @@ func (rl *Instance) Readline() (string, error) { | ||||
| 			var err error | ||||
| 			i, err = os.Stdin.Read(b) | ||||
| 			if err != nil { | ||||
| 				// i shouldnt really check the error like this but i dont know what | ||||
| 				// the actual thing is so | ||||
| 				if err.Error() == "read /dev/stdin: resource temporarily unavailable" { | ||||
| 				if errors.Is(err, syscall.EAGAIN) { | ||||
| 					err = syscall.SetNonblock(syscall.Stdin, false) | ||||
| 					if err == nil { | ||||
| 						continue | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user