Skip to content

Commit

Permalink
Reorder reader
Browse files Browse the repository at this point in the history
haccht committed Nov 4, 2023
1 parent 80e945b commit d781cc1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -30,9 +30,6 @@ func main() {
}

readers := make([]io.Reader, 0, len(args)+1)
if !terminal.IsTerminal(0) {
readers = append(readers, os.Stdin)
}
for _, arg := range args {
f, err := os.Open(arg)
if err != nil {
@@ -41,6 +38,9 @@ func main() {
defer f.Close()
readers = append(readers, f)
}
if !terminal.IsTerminal(0) {
readers = append(readers, os.Stdin)
}
if len(readers) == 0 {
os.Exit(0)
}

0 comments on commit d781cc1

Please sign in to comment.