diff --git a/catalyst-uploader.go b/catalyst-uploader.go index 02f823d..629771f 100644 --- a/catalyst-uploader.go +++ b/catalyst-uploader.go @@ -41,6 +41,7 @@ func run() int { } // replace stdout to prevent any lib from writing debug output there + stdout := os.Stdout os.Stdout, _ = os.Open(os.DevNull) uri := flag.Arg(0) @@ -57,12 +58,11 @@ func run() int { // success, write uploaded file details to stdout if glog.V(5) { - b, err := json.Marshal(map[string]string{"uri": uri}) + err = json.NewEncoder(stdout).Encode(map[string]string{"uri": uri}) if err != nil { glog.Fatal(err) return 1 } - glog.Info(string(b)) } return 0 diff --git a/catalyst-uploader_test.go b/catalyst-uploader_test.go index 7104bbd..52b7367 100644 --- a/catalyst-uploader_test.go +++ b/catalyst-uploader_test.go @@ -88,7 +88,7 @@ func TestFsHandlerE2E(t *testing.T) { defer os.Remove(outFileName) // run - uploader := exec.Command("go", "run", "catalyst-uploader.go", outFileName) + uploader := exec.Command("go", "run", "catalyst-uploader.go", "-v", "5", outFileName) uploader.Stdin = stdinReader stdoutRes, err := uploader.Output() require.NoError(t, err)