diff --git a/src/cmd.go b/src/cmd.go index ba84c6a..31a4763 100644 --- a/src/cmd.go +++ b/src/cmd.go @@ -24,10 +24,11 @@ func RunCommand(match string) (string, string) { var buffer bytes.Buffer if config.showProgramOutput { cmd.Stdout = &buffer + cmd.Stderr = &buffer } else { cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr } - cmd.Stderr = os.Stderr err = cmd.Run() diff --git a/src/main.go b/src/main.go index a2c8852..b6c70f9 100644 --- a/src/main.go +++ b/src/main.go @@ -70,7 +70,7 @@ func PrintHelp() { fmt.Println(" separated by a colon") fmt.Println(" --dirname Match the name of an existing directory") fmt.Println("\nOther keyword OPTIONS:") - fmt.Println("\n --show-output Show the output of COMMAND") + fmt.Println("\n --show-output Show the output (both stdout and stderr) of COMMAND") fmt.Println(" --filter Hide lines without a match") fmt.Println(" --help Display this help") fmt.Println("\nExamples:") diff --git a/test.sh b/test.sh index d457d51..ae41826 100755 --- a/test.sh +++ b/test.sh @@ -98,8 +98,10 @@ function run() { diff test/RESULT_$1 test/EXPECT_$1 ;; 19) - echo -e "./src/main.go:content\nMakefile:42:content" | ./lisst --filename --show-output echo -n foo > test/RESULT_$1 - echo -e "foo ./src/main.go" > test/EXPECT_$1 + echo -e "#!/bin/bash\necho \"\$@\";echo -n \"\$@\" 1>&2" > test/SCRIPT_$1 + chmod +x test/SCRIPT_$1 + echo -e "./src/main.go:content\nMakefile:42:content" | ./lisst --filename --show-output test/SCRIPT_$1 > test/RESULT_$1 + echo -e "./src/main.go\n./src/main.go" > test/EXPECT_$1 diff test/RESULT_$1 test/EXPECT_$1 ;; 20)