Repository navigation
Commit 7c2fb74
term: process bytes returned with a read error
The io.Reader contract permits Read to return both data and a non-nil
error. readLine currently returns the error before processing the data,
which can discard the final complete line when a reader returns data
with io.EOF.
Append returned bytes to the input buffer and save the accompanying
error. Report the error after the buffered input has been processed,
preserving it across ReadLine calls when the input contains a complete
line.
Add a regression test for a reader that returns "line\r" and io.EOF in
the same call.
Fixes golang/go#80661
Change-Id: I34ac28731ec40f3398b9c0990e19cc17b737ba9e
Reviewed-on: https://go-review.googlesource.com/c/term/+/808420
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>1 parent 3963fce commit 7c2fb74
2 files changed
Lines changed: 55 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
109 | 112 | | |
110 | 113 | | |
111 | 114 | | |
| |||
788 | 791 | | |
789 | 792 | | |
790 | 793 | | |
791 | | - | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
792 | 799 | | |
793 | 800 | | |
794 | 801 | | |
| |||
863 | 870 | | |
864 | 871 | | |
865 | 872 | | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
866 | 878 | | |
867 | 879 | | |
868 | 880 | | |
869 | 881 | | |
870 | | - | |
871 | 882 | | |
872 | 883 | | |
873 | | - | |
| 884 | + | |
874 | 885 | | |
875 | 886 | | |
876 | | - | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | 887 | | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
881 | 891 | | |
882 | 892 | | |
883 | 893 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
59 | 97 | | |
60 | 98 | | |
61 | 99 | | |
| |||
0 commit comments