From 17dac164ea4fa8a1108e7f7c9b3a13b7f557014e Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Fri, 6 Oct 2017 21:09:53 -0400 Subject: [PATCH] Don't store cmd stdout in string Storing the stdout confuses isatty causing programs running within ShellMode to not format properly. Fixes #862 --- cmd/micro/command.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/micro/command.go b/cmd/micro/command.go index 3c5baa26..ab8c3045 100644 --- a/cmd/micro/command.go +++ b/cmd/micro/command.go @@ -3,7 +3,6 @@ package main import ( "bytes" "fmt" - "io" "os" "os/exec" "os/signal" @@ -661,10 +660,10 @@ func HandleShellCommand(input string, openTerm bool, waitToFinish bool) string { args := SplitCommandArgs(input)[1:] // Set up everything for the command - var outputBuf bytes.Buffer + var output string cmd := exec.Command(inputCmd, args...) cmd.Stdin = os.Stdin - cmd.Stdout = io.MultiWriter(os.Stdout, &outputBuf) + cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr // This is a trap for Ctrl-C so that it doesn't kill micro @@ -680,7 +679,6 @@ func HandleShellCommand(input string, openTerm bool, waitToFinish bool) string { cmd.Start() err := cmd.Wait() - output := outputBuf.String() if err != nil { output = err.Error() }