You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2018/10/21 19:17:30 UTC

[cloudstack-cloudmonkey] 02/05: cli: fix pipe based output in shell

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git

commit d754b37cb4ceac906a861f1ac55b3e98e511879d
Author: Rohit Yadav <ro...@apache.org>
AuthorDate: Mon Oct 22 00:44:14 2018 +0530

    cli: fix pipe based output in shell
    
    Signed-off-by: Rohit Yadav <ro...@apache.org>
---
 cli/exec.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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 @@ package cli
 
 import (
 	"fmt"
+	"os"
 	"os/exec"
 	"runtime"
 
@@ -36,10 +37,9 @@ func ExecLine(line string) error {
 	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
 			}
 		}
 	}