(f io.Reader)
| 216 | } |
| 217 | |
| 218 | func (s *List) processListFile(f io.Reader) { |
| 219 | |
| 220 | // Parse the list file line by line, in a way that allows |
| 221 | // us to also check the status of the s.ci.Done channel |
| 222 | // to abort. |
| 223 | // This handles the case in which we're reading from stdin |
| 224 | // which is possibly never closed, but we still want to abort |
| 225 | // (eg: CTRL+C). |
| 226 | lines := make(chan string, 8) |
| 227 | |
| 228 | go func() { |
| 229 | scanner := bufio.NewScanner(f) |
| 230 | for scanner.Scan() { |
| 231 | line := scanner.Text() |
| 232 | if line == "" { |
| 233 | continue |
| 234 | } |
| 235 | err := scanner.Err() |
| 236 | if err != nil { |
| 237 | log.WithError(err).Fatal("Failed to scan list input file.") |
| 238 | } |
| 239 | lines <- line |
| 240 | } |
| 241 | err := scanner.Err() |
| 242 | if err != nil { |
| 243 | log.WithError(err).Fatal("Failed to scan list input file.") |
| 244 | } |
| 245 | close(lines) |
| 246 | }() |
| 247 | |
| 248 | for { |
| 249 | select { |
| 250 | case line, ok := <-lines: |
| 251 | if !ok { |
| 252 | return |
| 253 | } |
| 254 | |
| 255 | s.processFileOrList(line) |
| 256 | case <-s.ci.Done: |
| 257 | return |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | func (s *List) processList(fn string) error { |
| 263 | if fn == "-" { |
no test coverage detected