handle editor having arguments

This commit is contained in:
Cory Bennett
2015-02-21 21:15:02 -08:00
parent 3e6f2b396b
commit 7186fb3e3e
2 changed files with 9 additions and 3 deletions
+4 -1
View File
@@ -18,7 +18,7 @@ export GOPATH=$(shell pwd)
build:
cd src/github.com/Netflix-Skunkworks/go-jira/jira; \
go install -v
go get -v
all:
mkdir -p $(DIST); \
@@ -28,3 +28,6 @@ all:
echo "Building for $$p"; \
GOOS=$${p/-*/} GOARCH=$${p/*-/} go build -v -o $(DIST)/jira-$$p; \
done
fmt:
gofmt -s -w jira
+5 -2
View File
@@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/kballard/go-shellquote"
"github.com/op/go-logging"
"gopkg.in/yaml.v2"
"io/ioutil"
@@ -247,8 +248,10 @@ func (c *Cli) editTemplate(template string, tmpFilePrefix string, templateData m
for true {
if editing {
log.Debug("Running: %s %s", editor, tmpFileName)
cmd := exec.Command(editor, tmpFileName)
shell, _ := shellquote.Split(editor)
shell = append(shell, tmpFileName)
log.Debug("Running: %#v", shell)
cmd := exec.Command(shell[0], shell[1:]...)
cmd.Stdout, cmd.Stderr, cmd.Stdin = os.Stdout, os.Stderr, os.Stdin
if err := cmd.Run(); err != nil {
log.Error("Failed to edit template with %s: %s", editor, err)