Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #60 from gabrtv/fix-edit
Browse files Browse the repository at this point in the history
fix(edit): construct correct abspath to skel directory
  • Loading branch information
Gabriel Monroy committed Oct 26, 2015
2 parents d1fb0cd + de1c1b7 commit a0e3e76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions helm/action/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package action
import (
"os"
"path"
"path/filepath"
)

import (
Expand All @@ -16,7 +15,8 @@ import (
// - homeDir is the helm home directory for the user
func Create(chartName, homeDir string) {

skeletonDir, _ := filepath.Abs("skel")
skeletonDir := path.Join(homeDir, CachePath, "skel")

if fi, err := os.Stat(skeletonDir); err != nil {
log.Die("Could not find %s: %s", skeletonDir, err)
} else if !fi.IsDir() {
Expand Down
9 changes: 5 additions & 4 deletions helm/action/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ func Edit(chartName, homeDir string) {
if err != nil {
log.Die("could not open tempfile: %v", err)
}
defer os.Remove(f.Name())
f.Write(contents.Bytes())
f.Close()

// NOTE: removing the tempfile causes issues with editors
// that fork, so we let the OS remove them later

openEditor(f.Name())
saveChart(chartDir, f.Name())

Expand Down Expand Up @@ -125,12 +127,11 @@ func openEditor(filename string) {
log.Die("must set shell $EDITOR")
}

cmd = exec.Command(editor, filename)
args := []string{filename}
cmd = exec.Command(editor, args...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

// TODO: figure out why editor always exits non-zero
cmd.Run()
}

Expand Down

0 comments on commit a0e3e76

Please sign in to comment.