diff --git a/processor/processor.go b/processor/processor.go index 07c1073..7bc10e1 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -96,9 +96,11 @@ func Process() { } // Check if we are accepting data from stdin - stat, _ := os.Stdin.Stat() - if (stat.Mode() & os.ModeCharDevice) == 0 { - StandardInput = true + if len(DirFilePaths) == 0 { + stat, _ := os.Stdin.Stat() + if (stat.Mode() & os.ModeCharDevice) == 0 { + StandardInput = true + } } // If nothing was supplied as an argument to run against assume run against everything in the diff --git a/test-all.sh b/test-all.sh index bf19a35..ee8c21d 100755 --- a/test-all.sh +++ b/test-all.sh @@ -145,7 +145,7 @@ else exit fi -if echo "hello" | ./hashit main.go --hash md5 | grep -q -i 'b1946ac92492d2347c6235b4d2611184'; then +if echo "hello" | ./hashit --hash md5 | grep -q -i 'b1946ac92492d2347c6235b4d2611184'; then echo -e "${GREEN}PASSED stdin md5 test" else echo -e "${RED}=======================================================" @@ -154,7 +154,7 @@ else exit fi -if echo "hello" | ./hashit main.go --hash sha1 | grep -q -i 'f572d396fae9206628714fb2ce00f72e94f2258f'; then +if echo "hello" | ./hashit --hash sha1 | grep -q -i 'f572d396fae9206628714fb2ce00f72e94f2258f'; then echo -e "${GREEN}PASSED stdin sha1 test" else echo -e "${RED}=======================================================" @@ -163,7 +163,7 @@ else exit fi -if echo "hello" | ./hashit main.go --hash sha256 | grep -q -i '5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03'; then +if echo "hello" | ./hashit --hash sha256 | grep -q -i '5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03'; then echo -e "${GREEN}PASSED stdin sha256 test" else echo -e "${RED}======================================================="