Skip to content

Commit ed0bb9a

Browse files
authored
Merge pull request #204 from carlossg/issue-184
Do not use sdtin when directories are passed
2 parents bee8c2f + 8744b3d commit ed0bb9a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ var RootCmd = &cobra.Command{
7979
}
8080
// We detect whether we have anything on stdin to process if we have no arguments
8181
// or if the argument is a -
82-
if (len(args) < 1 || args[0] == "-") && !windowsStdinIssue && ((stat.Mode() & os.ModeCharDevice) == 0) {
82+
notty := (stat.Mode() & os.ModeCharDevice) == 0
83+
noFileOrDirArgs := (len(args) < 1 || args[0] == "-") && len(directories) < 1
84+
if noFileOrDirArgs && !windowsStdinIssue && notty {
8385
var buffer bytes.Buffer
8486
scanner := bufio.NewScanner(os.Stdin)
8587
for scanner.Scan() {

0 commit comments

Comments
 (0)