Don't store cmd stdout in string

Storing the stdout confuses isatty causing programs running within
ShellMode to not format properly.

Fixes #862
This commit is contained in:
Zachary Yedidia
2017-10-06 21:09:53 -04:00
parent b7c99c52d2
commit 17dac164ea

View File

@@ -3,7 +3,6 @@ package main
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"io"
"os" "os"
"os/exec" "os/exec"
"os/signal" "os/signal"
@@ -661,10 +660,10 @@ func HandleShellCommand(input string, openTerm bool, waitToFinish bool) string {
args := SplitCommandArgs(input)[1:] args := SplitCommandArgs(input)[1:]
// Set up everything for the command // Set up everything for the command
var outputBuf bytes.Buffer var output string
cmd := exec.Command(inputCmd, args...) cmd := exec.Command(inputCmd, args...)
cmd.Stdin = os.Stdin cmd.Stdin = os.Stdin
cmd.Stdout = io.MultiWriter(os.Stdout, &outputBuf) cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
// This is a trap for Ctrl-C so that it doesn't kill micro // 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() cmd.Start()
err := cmd.Wait() err := cmd.Wait()
output := outputBuf.String()
if err != nil { if err != nil {
output = err.Error() output = err.Error()
} }