cli: fix pipe based output in shell
Signed-off-by: Rohit Yadav <rohit@apache.org>
diff --git a/cli/exec.go b/cli/exec.go
index 32f2e2d..ec378cf 100644
--- a/cli/exec.go
+++ b/cli/exec.go
@@ -19,6 +19,7 @@
import (
"fmt"
+ "os"
"os/exec"
"runtime"
@@ -36,10 +37,9 @@
if runtime.GOOS != "windows" {
for _, arg := range args {
if arg == "|" {
- if result, err := exec.Command("bash", "-c", "cmk", line).Output(); err == nil {
- fmt.Println(string(result))
- return nil
- }
+ result, err := exec.Command("bash", "-c", fmt.Sprintf("%s %v", os.Args[0], line)).Output()
+ fmt.Print(string(result))
+ return err
}
}
}